简体   繁体   English

滑动时带有非同级幻灯片

[英]Swiper with non-sibling slides

I am using swiper as a slider for my mobile view. 我正在将swiper用作移动视图的滑块。 Basically, the divs that I would like to apply swiper-slide class are not siblings of each other. 基本上,我要应用swiper-slide类的div彼此不是同级的。

Here's the sample fiddle to demonstrate my use-case: https://jsfiddle.net/2prcosmk/ 这是示例小提琴以演示我的用例: https : //jsfiddle.net/2prcosmk/

Whenever I try to use swiper that way, the first slide is shown correctly but I can not perform actual sliding from first to any other slides (as its obvious in the demo fiddle when you try to move the slider). 每当我尝试以这种方式使用swiper时,都会正确显示第一张幻灯片,但是我无法执行从第一张幻灯片到任何其他幻灯片的实际幻灯片(这在尝试移动滑块时在演示中很明显)。 I wonder if its possible. 我想知道是否可能。 I can not really re-organize my html as I have multiple cards in multiple columns so each of these card would become one slide and so would the entire header. 我无法真正重新组织我的html,因为我在多列中有多张卡,因此这些卡中的每一张都将变成一张幻灯片,整个标题也将变成一张幻灯片。

Can you provide some suggestion here or any pointer on the code sample I've put? 您能在这里提供一些建议还是我所提供的代码示例中的任何指针吗? Thanks! 谢谢!

Update: I tried nesting the swiper-* classes in https://jsfiddle.net/2prcosmk/2/ and it does create swipers but the nested swiper content are just not displayed. 更新:我尝试将swiper- *类嵌套在https://jsfiddle.net/2prcosmk/2/中 ,它确实创建了滑动器,但是嵌套的滑动器内容只是不显示。 If I make inner swiper direction: 'horizontal' , it creates vertical swiper inside horizontal swiper as expected but horizontal inside horizontal does not seem to work. 如果我让内刷卡direction: 'horizontal' ,其水平刷卡内产生垂直刷卡的预期,但horizontalhorizontal似乎并没有工作。

The nearest I could go was to use nested: true and direction: 'horizontal' in the inner swiper. 我能走的最近的地方是在内部滑动器中使用nested: truedirection: 'horizontal' Here's the fiddle: https://jsfiddle.net/2prcosmk/3/ . 这是小提琴: https : //jsfiddle.net/2prcosmk/3/ One problem probably would be the pagination setup so if anyone can answer how we can combine together the two paginations, that would be awesome but for now, this is good enough. 分页设置可能是一个问题,所以如果有人可以回答我们如何将这两个分页结合在一起,那将是很棒的,但是就目前而言,这已经足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM