Object has no method 'flexslider'

末鹿安然 提交于 2020-01-04 13:50:43

问题


I am trying to set up 'flexslider' on my website.

So I am using this jQuery to load the function and apparently it doesnt load..

$(window).load(function() {
    $('.flexslider').flexslider({
        animation: "slides",
        animationLoop: false,
        itemWidth: 100,
        itemMargin: 5
    });
  });

But I get this errormessage when I am looking in the console:

Uncaught TypeError: Object [object Object] has no method 'flexslider' 

If the website could come to any help: http://nworks.nu/projects2013/sthlm/index.html


回答1:


Mainly two reasons for this error.

  1. Either you have not included the required plugin.
  2. You have included jQuery twice.

You are doing the second thing i.e. including jQuery twice.

jQuery 1.6.2 at the top (before flexslider js) and jQuery 1.9.1 at the bottom (right before </body>)

Please correct that and the error would be gone.

p.s. Use $(document).ready() in place of $(window).load() and do not use frames




回答2:


I had this same problem on a site I am editing, but oddly enough only one version of jQuery was being called, but so was:

jQuery.noConflict();

Be sure that is not happening to you.




回答3:


I had this error and it was the path to the flexslider.js file being incorrect. In the console the error was followed by the get call for the flexslider.js file. Clicking this goes to the network tab, which show the get of the file had failed.



来源:https://stackoverflow.com/questions/15716598/object-has-no-method-flexslider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!