use*_*671 13 navigation jquery bxslider
我想在点击bx寻呼机项目后继续自动滑动.
这是代码:
$(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();
});
});
Run Code Online (Sandbox Code Playgroud)
uncommented stopShow()和startShow()函数根本不起作用.startAuto()继续播放幻灯片,但bx寻呼机导航被冻结.即使出现新幻灯片,活动点仍保持活动状态.怎么解决?
Jaw*_*aad 19
你可以这样试试:
$(document).ready(function () {
var slider = $('.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.stopAuto();
slider.startAuto();
});
});
Run Code Online (Sandbox Code Playgroud)
或者您可以使用此:
$(document).ready(function () {
var slider = $('.bxslider').bxSlider({
mode: 'horizontal', //mode: 'fade',
speed: 500,
auto: true,
infiniteLoop: true,
hideControlOnEnd: true,
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;
});
});
Run Code Online (Sandbox Code Playgroud)
第二个对我有用.
以下代码在网站上正常工作.请试一试:
var slider = $('.bxslider').bxSlider({
auto: true,
pager: false,
autoHover: true,
autoControls: true,
onSlideAfter: function() {
slider.stopAuto();
slider.startAuto();
}
});
Run Code Online (Sandbox Code Playgroud)