jQuery.easing [jQuery.easing.def]不是一个函数

Eri*_*ves 21 wordpress jquery

当我查看火虫控制台时,我收到此错误.我想在wordpress上制作一个滑块.我正在使用本地主机,所以我无法准确地显示出什么.但是,当滑块只是在wordpress之外的html文件中时,它可以工作.在wordpress中,它给了我那个错误.任何有关问题的见解都将受到高度赞赏.谢谢.

col*_*ain 51

为了节省每个人一些时间.打开你的Jquery缓动插件文件并将代码包装在里面:

$(document).ready(function() {
  Code goes here...
});
Run Code Online (Sandbox Code Playgroud)


Ija*_*een 23

请检查您是否多次加载jQuery.如果已手动插入页脚,请尝试将其删除.


puc*_*chu 17

问题是

swing: function (x, t, b, c, d) {
    return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
}
Run Code Online (Sandbox Code Playgroud)

这个函数中的jQuery不能等于jQuery.extend( jQuery.easing,已经应用的jQuery .

  1. 替换jQuery$
  2. 用...包装代码

    (function($, undefined) {
      ...
    }) (jQuery);
    
    Run Code Online (Sandbox Code Playgroud)


pna*_*pna 5

你导入了jQuery缓动插件吗?就像是

  <script src="http://code.jquery.com/jquery.min.js"></script>
  <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

在你的页面?


San*_*ohn 5

if(typeof jQuery.easing[jQuery.easing.def] == 'function'){
    return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
}
Run Code Online (Sandbox Code Playgroud)

在 easing.js 上的 swing() 函数上试试这个代码