jquery显示语法错误

时间:2014-12-27 06:52:07

标签: javascript jquery

当我使用这个j-query代码显示语法错误时,我有一个不自动播放的滑块。但我确实发现了语法错误。请帮忙

jQuery(document).ready(function () {
    var photoslider = new WallopSlider('.photo-slider');
    //autoplay
    var count = photoslider.allItemsArrayLength;
    var start = photoslider.currentItemIndex;
    var end = count + 1;
    var index = start;

    jQuery(function () {
        setInterval(function () {
            photoslider.goTo(index);
            ++index;
            if (index == end) {
                index = start
            }
        }, 3000);
    });

3 个答案:

答案 0 :(得分:2)

请在编码后加上});

答案 1 :(得分:1)

你忘了把jQuery(document).ready(function() {的大括号和括号括起来。这是})

答案 2 :(得分:1)

 jQuery(document).ready(function () {
     var photoslider = new WallopSlider('.photo-slider');
     //autoplay
     var count = photoslider.allItemsArrayLength;
     var start = photoslider.currentItemIndex;
     var end = count + 1;
     var index = start;

    jQuery(function () {  
         setInterval(function () {
             photoslider.goTo(index);
             ++index;
             if (index == end) {
                 index = start
            }
         }, 3000);
     });
 }); //--> this is missing