问题
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