jQuery 如何在 bxslider 上设置幻灯片持续时间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21683080/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set up slide duration at bxslider
提问by M.ichael
I know I can set the speed of the transition (with speed
). But is there any option to set the duration a slide is shown until the transition to the next slide begins?
我知道我可以设置转换速度(使用speed
)。但是,是否有任何选项可以设置幻灯片的显示持续时间,直到过渡到下一张幻灯片开始?
回答by Trevor
Using the pause
option:
使用pause
选项:
$('.bxslider').bxSlider({
pause: 3000
});
Example:
例子:
http://jsfiddle.net/Yq3RM/202/
http://jsfiddle.net/Yq3RM/202/
Update
更新
Another example that modifies the pause for each image. bxSlider doesn't have a nice built in way to do this that I am aware of, however I was able to pull it off in the following way:
另一个修改每个图像暂停的例子。bxSlider 没有一个很好的内置方式来做到这一点,我知道,但是我能够通过以下方式实现它:
var ImagePauses = [1000,3000,6000,9000,12000,15000];
var slider = $('.bxslider').bxSlider();
modifyDelay(0);
function modifyDelay(startSlide){
slider.reloadSlider({
mode: 'horizontal',
infiniteLoop: true,
auto: true,
autoStart: true,
autoDirection: 'next',
autoHover: true,
pause: ImagePauses[startSlide],
autoControls: false,
pager: true,
pagerType: 'full',
controls: true,
captions: true,
speed: 500,
startSlide: startSlide,
onSlideAfter: function($el,oldIndex, newIndex){
modifyDelay(newIndex);
}
});
}