jQuery,and other library right order to include?

故事扮演 提交于 2020-01-06 03:20:30

问题


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

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