问题
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.
- Either you have not included the required plugin.
- 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