twitter-bootstrap 如何禁用引导轮播动画?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18760225/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 18:21:53  来源:igfitidea点击:

How to disable bootstrap carousel animation?

javascripttwitter-bootstrapcarousel

提问by IgorCh

For example I have carousel with 3 images, when the carousel slides the new images are added via 'slid' event

例如,我有 3 张图像的轮播,当轮播滑动时,新图像是通过 'slid' 事件添加的

$('#imageCarousel').on('slid', function (event) {
      //add more images
});

I want to disable animation for the carousel, so transition time is set to 0 in carousel css as it was shown here removing carousel animation. But after that 'slid' event does not fire. I cannot use 'slide' event, because I need to know which item is active in the carousel, but the 'active' class is not set up after the 'slide' event. How can I solve it? Thanks.

我想禁用旋转木马的动画,因此在旋转木马 css 中将过渡时间设置为 0,如此处所示删除旋转木马动画。但在那之后“滑动”事件不会触发。我不能使用 'slide' 事件,因为我需要知道哪个项目在轮播中处于活动状态,但是在 'slide' 事件之后没有设置 'active' 类。我该如何解决?谢谢。

回答by Able Alias

I suppose you can use the following code,

我想你可以使用以下代码,

just remove the slideclass from carouseldiv and use like,

只需slidecarouseldiv 中删除该类并使用类似的方法,

<div class="carousel"> 

this will remove the slide animation effect, see the working fiddle,

这将删除幻灯片动画效果,请参阅工作小提琴