为什么循环内容轮播jQuery插件不适用于Bootstrap 3

Why Circular Content Carousel jQuery plugin does not work with Bootstrap 3

本文关键字:不适用 插件 适用于 Bootstrap jQuery 循环 为什么      更新时间:2023-09-26

我一直在尝试向我的网站添加一个jquery轮播,它几乎完全基于bootstrap 3。 问题是我添加的轮播不起作用。轮播中的所有幻灯片同时显示,并溢出到网站中的其他项目上。我已经附加了所有必要的js和css文件。

我使用过循环内容轮播

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

Bootstrap 3 需要 1.9 版(或更高版本)中的 jQuery,该版本使用 .on() 而不是 .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 ) {
    //...
});