如何附加“幻灯片” &安培; "滑动" Bootstrap工具包的轮播事件? [英] How to attach "slide" & "slid" events to the Bootstrap toolkit's carousel?

查看:155
本文介绍了如何附加“幻灯片” &安培; "滑动" Bootstrap工具包的轮播事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个工作Bootstrap轮播的小提琴。
http://jsfiddle.net/jeykeu/5TDff/

Here's a fiddle with a working Bootstrap carousel. http://jsfiddle.net/jeykeu/5TDff/

这是官方文档,它没有说明事件的使用情况。
http://twitter.github.com/bootstrap/javascript.html#carousel

And here's the official documentation which tells nothing about event usage. http://twitter.github.com/bootstrap/javascript.html#carousel

我认为这会有效但不是:

I thought this would work but no:

     $('#carousel').bind('slide',function(){
            alert("Slide Event");
    });


推荐答案

基于你的小提琴# carousel 错了。它应该是 #myCarousel

Based on your fiddle #carousel is wrong. It should be #myCarousel.

更新示例:

$('#myCarousel').carousel({
    interval: 2000
});

// Could be slid or slide (slide happens before animation, slid happens after)
$('#myCarousel').on('slid', function() {
    alert("Slide Event");
});​

http://jsfiddle.net/infiniteloops/wPF3n/

使用Bootstrap 3

With Bootstrap 3

http:// jsfiddle .net / infiniteloops / wPF3n / 252 /

这篇关于如何附加“幻灯片” &安培; "滑动" Bootstrap工具包的轮播事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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