传送带滑轨(未滑动)事件,引导程序3上的火事件 [英] Fire event on carousel slide (not slid) event, Bootstrap 3

查看:93
本文介绍了传送带滑轨(未滑动)事件,引导程序3上的火事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自举2似乎很好地工作搬运滑动事件(参见)使用以下代码:

  $('#myCarousel')。bind ('slide',function(e){
console.log('slide event!');
});

然而,我不能在Bootstrap 3中获得相同的功能(请参阅 this fiddle )。任何人都知道为什么?

解决方案

实际事件名称空间用于 slide 根据bootstrap3实现是 slide.bs.carousel ,而不是 slide 这是一个acc:对BS2,也使用 sliding.bs.carousel 来跟踪幻灯片的完成情况(尽管滑动

所以试试:

  $ ('#myCarousel')。bind('slide.bs.carousel',function(e){
console.log('slide event!');
});

演示

Bootstrap 2 seems to work fine handling the slide event (see this question) with the following code:

$('#myCarousel').bind('slide', function (e) {
    console.log('slide event!');
});

I cannot, however, get the same things to work in Bootstrap 3 (see this fiddle). Anyone know why?

解决方案

Actual event namespace for slide according to bootstrap3 implementation is slide.bs.carousel as opposed to slide which was the one acc: to BS2, also use slid.bs.carousel to track completion of slide (though slid seems to work.)

So try:

$('#myCarousel').bind('slide.bs.carousel', function (e) {
    console.log('slide event!');
});

Demo

这篇关于传送带滑轨(未滑动)事件,引导程序3上的火事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆