2

我正在尝试在我的网站上设置“flexslider”。

所以我使用这个jQuery来加载函数,显然它没有加载..

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

但是当我在控制台中查看时收到此错误消息:

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

如果该网站可以提供任何帮助: http: //nworks.nu/projects2013/sthlm/index.html

4

3 回答 3

4

这个错误主要有两个原因。

  1. 要么您没有包含所需的插件。
  2. 你已经包含了 jQuery 两次。

您正在做第二件事,即两次包括 jQuery。

jQuery 1.6.2 在顶部(在 flexslider js 之前)和 jQuery 1.9.1 在底部(就在 之前</body>

请纠正它,错误就会消失。

ps$(document).ready()代替使用$(window).load()和不使用frames

于 2013-03-30T08:40:59.567 回答
0

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.

于 2013-07-09T00:02:44.537 回答
0

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.

于 2013-12-30T14:32:10.077 回答