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