Swiper中文论坛

标题: 拿到了swiper-slide的索引,但是怎么操作里面的元素? [打印本页]

作者: hanlei06059950    时间: 2016-4-21 19:11
标题: 拿到了swiper-slide的索引,但是怎么操作里面的元素?
比如,我有5个swiper-slide,当走到相应的swiper-slide时,我给他拉下面插入一个div元素;现在是拿到了swiper-slide索引,可是操作他里面的东西就不会了 ;
swiper-slide的索引是拿到了,但是不会操作;
  1. var myswiper = new Swiper('#swiper-container2', {
  2.         slidesPerView: 5,
  3.         spaceBetween: 8,
  4.         onSlideChangeEnd: function(){
  5.                       alert(myswiper.activeIndex);  //弹出索引;
  6. //这里怎么操作啊???
  7.                      
  8.                      
  9.                      
  10.             }
  11.    });
复制代码

求指导啊。。。。


作者: hanlei06059950    时间: 2016-4-22 11:14
没人吗???
作者: 菜鸟来袭    时间: 2016-4-22 16:35
很简单啊,加个判断 if (myswiper.activeIndex==下标值){//代码 }else if(myswiper.activeIndex==下标值 ){// };不用谢叫我雷锋




欢迎光临 Swiper中文论坛 (http://bbs.swiper.com.cn/) Powered by Discuz! X3.2