[英]Show next Slide for current .flexslider only
我希望有人可以幫助我修改以下jQuery腳本片段,使其僅轉到單擊對象的下一張幻燈片,而不是頁面上的所有.flexslider實例
$(window).load(function() {
$('[id^=flexslider_]').flexslider({
animation: 'fade',
slideshow: false,
controlNav: false,
directionNav : false,
controlsContainer: '.flex-container',
start: function(slider) {
$('.slides li').click(function(event){
event.preventDefault();
slider.flexAnimate(slider.getTarget("next"));
});
}
});
});
目前,如果我單擊.flexslider中的任何li元素,則所有我的滑塊都會更改。 我只想選擇我要單擊的滑塊
編輯
我已經放了
console.log(slider);
看看是否正在找到每個滑塊,輸出是
div#flexslider_5.flexslider
div#flexslider_6.flexslider
所以它發現了
謝謝
對我現有的設置進行細微調整可以正常工作,以為我會發布此消息,以防它對其他人有所幫助
$(window).load(function() {
$('[id^=flexslider_]').flexslider({
animation: 'fade',
slideshow: false,
controlNav: false,
directionNav : false,
controlsContainer: '.flex-container',
start: function(slider) {
slider.find('.slides').click(function(event){ // Added slider.find('.slides')
event.preventDefault();
slider.flexAnimate(slider.getTarget("next"));
});
}
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.