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!
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
Post a Comment