为什么循环内容Carousel jQuery插件不能与Bootstrap 3一起使用

时间:2015-03-08 07:54:19

标签: javascript jquery css twitter-bootstrap-3 carousel

我一直在尝试在我的网站上添加一个jquery轮播,几乎完全基于bootstrap 3.问题是我添加的轮播无效。旋转木马中的所有幻灯片同时出现,并且溢出到网站上的其他项目中。我附上了所有必要的js和css文件。

我使用过circular content carousel

1 个答案:

答案 0 :(得分:1)

循环内容轮播使用.live()作为事件附件,自jQuery 1.7以来已弃用。

Bootstrap 3需要1.9版(或更高版本)中的jQuery,.on()使用event delegation代替.live()

问题在于插件代码的这些行:

// click to open the item(s)
$el.find('a.ca-more').live('click.contentcarousel', function( event ) {
    //...
});

// click to close the item(s)
$el.find('a.ca-close').live('click.contentcarousel', function( event ) {
    //...
});

要使用boostrap 3(jQuery> = 1.9),请使用.on()代替:

// click to open the item(s)
$el.find('a.ca-more').on('click.contentcarousel', function( event ) {
    //...
});

// click to close the item(s)
$el.find('a.ca-close').on('click.contentcarousel', function( event ) {
    //...
});