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'
        });
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站