jquery - Javascript script loading order - function undefined -


i working within not nice template has forced me load scripts in js can not control there order. trying load library when attempt call it, undefined error.

$.getscript( "js/velocity.min.js").done(function(){     $('body').velocity({ width: 200}) }); 

get error: uncaught typeerror: $(...).velocity not function

how can be? loaded you!

enter image description here

ok there conflict script has loaded, fix wrapper velocity code in closure , set 'define' null within it.

(function($){     var define = null;     //then velocity code here })(jquery) 

be sure loading zepto/jquery before velocity.js

<script type='text/javascript' src='js/zepto.min.js'></script> <script type="text/javascript" src="js/velocity.min.js"></script> 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -