jQuery.easing[jQuery.easing.def] is not a function

匿名 (未验证) 提交于 2019-12-03 02:16:02

问题:

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.

回答1:

To save everyone some time. Open your Jquery easing plugin file and wrap the code inside:

$(document).ready(function() {   Code goes here... }); 


回答2:

Please check that whether you are loading jQuery more than once. If you have inserted in the footer manually, try removing it.



回答3:

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.

  1. replace jQuery with $
  2. wrap code with

    (function($, undefined) {   ... }) (jQuery); 


回答4:

did you import the jQuery easing plugin? something like

  <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?



回答5:

Put jquery.easing.1.3.js to head tag before using plugin or use document.ready



回答6:

are you importing the jQuery easing plugin? or anything higher then 1.7.2 ?then just remove that and user the below one... will be working....

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script> 


回答7:

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



回答8:

Don't declare the script on the header, call it through jQuery's .getScript() function when the document is fully loaded.

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!