我想在点击bx寻呼机项目后继续自动滑动.
解决方法@H_502_10@
以下是代码:
$(document).ready(function () { $('.bxslider').bxSlider({ mode: 'horizontal',//mode: 'fade',speed: 500,auto: true,infiniteLoop: true,hideControlOnEnd: true,useCSS: false }); $(".bx-pager-link").click(function () { console.log('bla'); slider = $('.bxslider').bxSlider(); slider.stopAuto(); slider.startAuto(); //slider.stopShow(); //slider.startShow(); }); });
uncommented stopShow()和startShow()函数根本不起作用. startAuto()继续幻灯片放映,但bx寻呼机导航被冻结.即使出现新的幻灯片,活动点仍保持活动状态.如何解决?
@H_403_8@解决方法@H_502_10@
你可以这样尝试:
$(document).ready(function () {
var slider = $('.bxslider').bxSlider({
mode: 'horizontal',useCSS: false
});
$(".bx-pager-link").click(function () {
console.log('bla');
slider.stopAuto();
slider.startAuto();
});
});
或者你可以使用这个:
$(document).ready(function () {
var slider = $('.bxslider').bxSlider({
mode: 'horizontal',useCSS: false
});
$('.bx-pager-item a').click(function(e){
var i = $(this).index();
slider.goToSlide(i);
slider.stopAuto();
restart=setTimeout(function(){
slider.startAuto();
},500);
return false;
});
});
第二个是为我工作.
@H_403_8@
@H_403_8@
$(document).ready(function () { var slider = $('.bxslider').bxSlider({ mode: 'horizontal',useCSS: false }); $(".bx-pager-link").click(function () { console.log('bla'); slider.stopAuto(); slider.startAuto(); }); });
或者你可以使用这个:
$(document).ready(function () { var slider = $('.bxslider').bxSlider({ mode: 'horizontal',useCSS: false }); $('.bx-pager-item a').click(function(e){ var i = $(this).index(); slider.goToSlide(i); slider.stopAuto(); restart=setTimeout(function(){ slider.startAuto(); },500); return false; }); });
第二个是为我工作.
@H_403_8@ @H_403_8@