简体   繁体   English

未捕获的TypeError:没有方法'responsiveSlides'

[英]Uncaught TypeError: no method 'responsiveSlides'

I'm trying to implement the responsiveSlides plugin on a Wordpress theme. 我正在尝试在Wordpress主题上实现responsiveSlides插件。 I've got the necessary css, jquery and javascript files linked and in the order below and there are no other jquery/javascript plugins. 我有必要的css,jquery和javascript文件链接,并在下面的顺序,没有其他jquery / javascript插件。

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link rel="stylesheet" href="<?bloginfo('template_directory'); ?>/responsiveslides.css" />
<script src="<?bloginfo('template_directory'); ?>/responsiveslides.min.js" type="text/javascript"></script>

And then I included a script tag calling the function to initiate the slideshow but got the error 然后我添加了一个脚本标签,调用该函数来启动幻灯片放映但得到了错误

<script>
$(function () {

  $("#slider").responsiveSlides({
    maxwidth: 800,
    speed: 50
  });

});

Uncaught TypeError: Object [object Object] has no method 'responsiveSlides' 未捕获的TypeError:对象[object Object]没有方法'responsiveSlides'

I replaced "responsiveSlides" with "Hide" to test if jquery is working and it did. 我用“隐藏”替换了“responsiveSlides”,以测试jquery是否正常工作。 It appears that I have all the necessary files linked (responsiveSlides.min.js...etc) as shown in the browser developer tool and in the proper order. 似乎我已经链接了所有必需的文件(responsiveSlides.min.js ...等),如浏览器开发人员工具中所示,并且顺序正确。 Not exactly sure why this is not working. 不确定为什么这不起作用。 If you can provide any pointer it is much appreciated. 如果你能提供任何指针,我们非常感谢。

Try the following 请尝试以下方法

(function ($) {

  $("#slider").responsiveSlides({
    maxwidth: 800,
    speed: 50
  });

})(jQuery);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM