问题
I have a Wordpress theme that uses MooTools and jQuery. I use jQuery noConflict
to avoid conflicts with other JS libraries; this didn't help me.
Can someone help me with the right order of including JS libraries on my Wordpress theme?
Thanks in advance.
回答1:
What you need to do is add this before your jquery code :
jQuery.noConflict();
and replace all JQuery $
by jQuery
. For example :
jQuery(document).ready(function($) {
// Code that uses jQuery's $ can follow here.
});
// Code that uses other library's $ can follow here.
来源:https://stackoverflow.com/questions/2534977/jquery-and-other-library-right-order-to-include