jquery easing breaks jquery on wordpress

瘦欲@ 提交于 2019-12-12 02:13:29

问题


Im getting an error when i add the jquery easing 1.3 plugin to my page, i havent even used custom easing yet but just loading it stops animated elements working. Im not a jquery expert so i dont really know how to debug it but im fairly sure that there is a conflict, heres the error:

Uncaught TypeError: Property 'undefined' of object #<Object> is not a function

The error is triggered when you roll over the animated elements, heres the page im working on:

http://www.pegbarandgrill.com/blog/

if you roll over the links & directory you should see an animated menu open but this is when you will get the error. I sourced jquery and easing with the following lines

<script type="text/javascript" src="/wp-content/themes/pegbarAndGrill_01/script/jquery.js"></script>
<script type="text/javascript" src="/wp-content/themes/pegbarAndGrill_01/script/easing.js"></script>

Also if i remove the wp_head() and wp_footer() functions the conflict goes away. Any idea what the problem might be?

Many thanks


回答1:


Try to wrap contents of easing.js file with

$(document).ready(function() {
...
});

It saved my time before!




回答2:


I got the same error message. I had jQuery, jQuery UI, the easing plugin, and a call to jQuery.noConflict() in the wrong order.

I had been using jQuery.noConflict() to get around some other problem from a long time ago, but I no longer needed that so I removed it.

I then put the <script> elements in this order:

<script type='text/javascript' src="/js/jquery-1.8.0.min.js"></script>
<script type='text/javascript' src="/js/jquery-ui-1.8.23.custom.min.js"></script>
<script type='text/javascript' src="/js/jquery.easing.1.3.js"></script>

This fixed the problem.



来源:https://stackoverflow.com/questions/8345395/jquery-easing-breaks-jquery-on-wordpress

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