开发者

Jquery conditionally load on a wordpress page

my website is powered by wordpress and I have conflicting plugins.

I found when I remove the

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 

from the header to load the Jquery libary, the plugin works but al开发者_Go百科l other Jquery elements do not.

I thought a good solution would be to make a condition where Jquery does not load on the page where I am running the plugin to stop the conflict but I am not sure if this is possible or how to achieve this.

Any help on the matter would be appriciated.

Thanks.


Just add jQuery.noConflict(); after adding jquery.min.js just like that:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
<script type="text/javascript">jQuery.noConflict();</script>

From this point you will need to use jQuery() instead of $(), but it will be conflict free.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜