doubu1853
2013-09-29 04:08
浏览 36

未捕获的TypeError:对象[object Object]在chrome中没有方法'cycle'

So I have a website that is done in PHP. I have to include a simple slider in the website with this code.

http://jsfiddle.net/Wb3se/

$('#slides').cycle({ 
    fx: 'scrollLeft'
});

Very very simple code. Im getting that error which from what I understand usually means that the browser does not understand what 'cycle' mean. I am using jquery 1.10. So no idea why it would do that. Here is how it is setup.

Header.php has a link to jQuery on googles server, and has a link to a hard copy of cycle.js on the server.

The body has the html in it, css file has css in it

footer has the java.js file with the javascript in it followed by </body> tag.

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongsi7759 2013-09-29 04:52
    已采纳

    It sounds like the cycle plugin isn't loaded when you're initializing the slideshow. Check the NET tab in firebug or the resources tab in Chrome developer tools. Make sure the link to cycle is before your slideshow code. Also, make sure the DOM is ready when you initialize cycle:

    $(function() {
        $('#slides').cycle({ 
            fx: 'scrollLeft'
        });
    });
    

    or

    $(document).ready(function() {
        $('#slides').cycle({ 
            fx: 'scrollLeft'
        });
    });
    
    打赏 评论

相关推荐 更多相似问题