为什么循环内容Carousel jQuery插件不能与Bootstrap 3一起使用 [英] Why Circular Content Carousel jQuery plugin does not work with Bootstrap 3

查看:79
本文介绍了为什么循环内容Carousel jQuery插件不能与Bootstrap 3一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have been trying to add a jquery carousel to my website which is nearly completely based on bootstrap 3. the problem is that the carousel which I added is not working. All the slides in the carousel are appearing at the same time and are overflowing onto other items in the website. I have attached all the necessary js and css files.

我用循环内容轮播

推荐答案

循环内容轮播使用 .live() 作为事件附件,自此后不推荐使用jQuery 1.7。

Circular content carousel uses .live() as an event attachment, which is deprecated since jQuery 1.7.

Bootstrap 3需要1.9版(或更高版本)中的jQuery,它使用 .on() 事件委派 而不是 .live()

Bootstrap 3 requires jQuery in version 1.9 (or higher) which uses .on() for event delegation instead of .live().

问题出在这些插件代码行中:

The problem is with these lines of the plugin code:

// 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()而不是:

To get it work with boostrap 3 (jQuery >= 1.9) use .on() instead:

// 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 ) {
    //...
});

这篇关于为什么循环内容Carousel jQuery插件不能与Bootstrap 3一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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