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.
- replace
jQuery
with$
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:
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
回答7:
Are you importing the jQuery easing plugin? Or anything higher than 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>
回答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.
回答9:
It may happen if you are calling the WordPress slider plugin's javascript before jQuery or jQuery UI call.
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>