Swiper中文论坛
标题:
求助,swiper 滚动到某一屏后的回调函数
[打印本页]
作者:
哆啦A梦
时间:
2015-11-18 21:40
标题:
求助,swiper 滚动到某一屏后的回调函数
swiper 滚动到某一屏后的回调函数是什么呢?为什么我这么写,#top_arrow并没有隐藏。有大神知道的吗?onSlideChangeEnd: function(swiper){
if(mySwiper.activeIndex == 4){
$("#top-arrow").hide();
}else{
$("#top-arrow").show();
}
},
作者:
tvrfqbmnm
时间:
2015-11-19 09:53
onSlideChangeEnd: function(swiper){
for(i = 0; i < swiper.slides.length; i++){
if(i == 4 && i == swiper.activeIndex){
var elements = swiper.slides[swiper.activeIndex].querySelectorAll("[id^='top-arrow']");
for(a = 0; a < elements.length; a++){
if(elements[a].attributes["style"]){
var temp = elements[a].attributes["style"].value;
temp = temp.replace(/display\s*:\s*[a-z]*\s*;/i, "");
temp = temp + "display:none;";
elements[a].setAttribute("style", temp);
}else{
elements[a].setAttribute("style", temp);
}
}
}else{
var elements = swiper.slides[i].querySelectorAll("[id^='top-arrow']");
for(a = 0; a < elements.length; a++){
if(elements[a].attributes["style"]){
var temp = elements[a].attributes["style"].value;
temp = temp.replace(/display\s*:\s*[a-z]*\s*;/i, "");
if(temp != ""){
elements[a].setAttribute("style", temp);
}else{
elements[a].removeAttribute("style");
}
}
}
}
}
}
欢迎光临 Swiper中文论坛 (http://bbs.swiper.com.cn/)
Powered by Discuz! X3.2