jCarousel(v0.3.0),Uncaught TypeError:无法调用null jquery.jcarousel.min.js的方法'index':1

时间:2013-11-25 19:11:45

标签: jquery jcarousel

我的主页有一个旋转木马。但是当点击菜单链接时,此时只有轮播照片会发生变化,并且必须开始自动启动圆形幻灯片。一切都好,但有时谷歌铬给控制台错误。而不是开始自动启动轮播,有时停止到最后一项。我想点击菜单重新加载新的轮播数据并自动启动我的圆形转盘。

jcarousel版本:v0.3.0 - 2013-11-22 jquery版本:1.10.1.min

</head>标记我的代码之前

$(document).ready(function(){
    var jcarousel = $('.jcarousel');
    jcarousel.jcarousel({
        wrap:'circular',
        animation:{duration:1500,easing:'easeInOutExpo'}
    })
    .jcarouselAutoscroll({interval:2000});

    $('.prev').jcarouselControl({target: '-=1'});
    $('.next').jcarouselControl({target: '+=1'});
});

旋转木马后来我的菜单脚本。

$(document).ready(function(){
    $(".depth0").delegate('a','click',function(){
        var id=$(this).attr("rel");
        if(id){
            $.get("/jcarousel.php?carousel="+id,function(data){
                $('.jcarousel').html(data).jcarousel('reload',{wrap:'circular',animation:{duration:1500,easing:'easeInOutExpo'}}).jcarouselAutoscroll({interval:2000,autostart:true});
            });
        }
    });
});

chrome console错误:

Uncaught TypeError: Cannot call method 'index' of null jquery.jcarousel.min.js:1
$.jCarousel.plugin.prepare jquery.jcarousel.min.js:1
$.jCarousel.plugin.reload jquery.jcarousel.min.js:1
$.jCarousel.plugin._create jquery.jcarousel.min.js:1
create jquery.jcarousel.min.js:1
$.(anonymous function) jquery.jcarousel.min.js:1
(anonymous function) jquery.jcarousel.min.js:1
x.extend.each jquery.min.js:4
x.fn.x.each jquery.min.js:4
$.fn.(anonymous function) jquery.jcarousel.min.js:1
(anonymous function) (index):37
c jquery.min.js:4
p.fireWith jquery.min.js:4
x.extend.ready jquery.min.js:4
q

我的问题:

1)轮播wrap:'circular'无效。停止旋转木马。

2)有时轮播会自动启动,但会在最后一项停止。

3)有时Chrome控制台会出现索引错误。

感谢您的帮助。

抱歉我的英语不好。

0 个答案:

没有答案