Testing if jQueryTools has loaded

≡放荡痞女 提交于 2019-12-12 05:59:08

问题


How can I test if jQueryTools library has been loaded like we can do in jQuery or jQueryUI?

As I use cdn to load the libraries, I have to be sure of are properly loaded. With jQuery I use this code (using jQuery() function):

if (jQuery) {
  // library loaded
}

So I load the library using:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="jquery.min.js"><\/script>')</script>

Anything similar with jQueryTools?


回答1:


You can just check and see if one of the methods in that plugin exists like this example:

if(!jQuery().overlay) {
     // plug-in is not installed
}


来源:https://stackoverflow.com/questions/12654409/testing-if-jquerytools-has-loaded

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