javascript - Check if library is loaded or initialized -
i'm using rs slider js library load on few pages not site have script, common site, trigger libraries, example:
var revapi; jquery(document).ready(function() { revapi = jquery('.tp-banner').revolution( { delay:9000, startwidth:1170, startheight:500, hidethumbs:10, lazyload:"on" }); });
in cases, when library js aren't loaded because don't need part of code triggers "minors" errors, how check if js loaded or if revolution()
object exists or else avoid problem? yours handle this?
you can check specific class exists before initializing plugin. if doesn't plugin function never gets called , won't throw errors
if( $('.revolutionclass').length ){ /* initialize plugin */ }
Comments
Post a Comment