jQuery.easing[jQuery.easing.def] 不是一个函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11533168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jQuery.easing[jQuery.easing.def] is not a function
提问by Eric Goncalves
I am getting this error when I look in the fire bug console. I am trying to make a slider on wordpress. I am working on a localhost so I cant exactly show whats up. However, when the slider is just in an html file outside of wordpress it works. When in wordpress, it is giving me that error. Any insight into what the problem could be will be greatly appreciated. Thanks.
当我查看 fire bug 控制台时出现此错误。我正在尝试在 wordpress 上制作一个滑块。我正在本地主机上工作,所以我无法准确显示最新情况。但是,当滑块位于 wordpress 之外的 html 文件中时,它可以工作。在 wordpress 中,它给了我那个错误。对问题可能是什么的任何见解将不胜感激。谢谢。
回答by coletrain
To save everyone some time. Open your Jquery easing plugin file and wrap the code inside:
为大家节省一些时间。打开您的 Jquery 缓动插件文件并将代码包装在其中:
$(document).ready(function() {
Code goes here...
});
回答by Ijas Ameenudeen
Please check that whether you are loading jQuery more than once. If you have inserted in the footer manually, try removing it.
请检查您是否多次加载 jQuery。如果您已手动插入页脚,请尝试将其删除。
回答by puchu
The problem is
问题是
swing: function (x, t, b, c, d) {
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
}
jQuery in this function could not be equal to the jQuery, where jQuery.extend( jQuery.easing,
has been applied.
这个函数中的 jQuery 不能等同于 jQuery,这里jQuery.extend( jQuery.easing,
已经应用了。
- replace
jQuery
with$
wrap code with
(function($, undefined) { ... }) (jQuery);
- 替换
jQuery
为$
用代码包装
(function($, undefined) { ... }) (jQuery);
回答by pna
did you import the jQuery easing plugin? something like
你导入了 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>
in your page?
在你的页面?
回答by nixis
Put jquery.easing.1.3.js to head tag before using plugin or use document.ready
在使用插件或使用 document.ready 之前将 jquery.easing.1.3.js 放在 head 标签中
回答by Sanhosh john
if(typeof jQuery.easing[jQuery.easing.def] == 'function'){
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
}
try this code on swing() function on easing.js
在 easing.js 上的 swing() 函数上试试这个代码
回答by shiny
Are you importing the jQuery easing plugin? Or anything higher than 1.7.2?
您是否正在导入 jQuery 缓动插件?或者高于 1.7.2 的任何东西?
Then just remove that and use this:
然后只需删除它并使用它:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script>
回答by luis
Don't declare the script on the header, call it through jQuery's .getScript() function when the document is fully loaded.
不要在头部声明脚本,当文档完全加载时通过 jQuery 的 .getScript() 函数调用它。
Example:
例子:
<script>
$( document ).ready(function() {
$.getScript('path_to_script/easing_script_name.js');
});
</script>
The error is due to that jQuery is called before easing script it's fully loaded.
该错误是由于在缓动脚本完全加载之前调用了 jQuery。
回答by Ritam Das
It may happen if you are calling the WordPress slider plugin's javascript before jQuery or jQuery UI call.
如果您在 jQuery 或 jQuery UI 调用之前调用 WordPress 滑块插件的 javascript,则可能会发生这种情况。
Does it resolve this way?
是这样解决的吗?
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.4/umd/popper.min.js"></script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/wordpress-slider-plugin.js"></script>