What is the correct loading order javascript script in a HTML file if was using cordova and jqm?
I have this sample:
<script type="text/javascript" src="cordova.js"></script>
<script src="js/controllerCordova.js"></script>
<script src="js/javascript.js"></script>
<script src="js/jquery-1.3.2.js"></script>
<script src="js/jquery.mobile-1.2.1.min.js"></script>
you may use order like this
<script src="js/jquery-1.3.2.js"></script>
<script src="js/jquery.mobile-1.2.1.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script src="js/controllerCordova.js"></script>
<script src="js/javascript.js"></script>
For posterity's sake, I fix the only answer. The JQuery Mobile must be loaded after the custom script because the mobileinit
event is triggered as soon as the JQuery Mobile script is loaded.
Reference : http://demos.jquerymobile.com/1.0/docs/api/globalconfig.html
<script src="jquery.js"></script>
<script src="custom-scripting.js"></script>
<script src="jquery-mobile.js"></script>
On the contrary, it seems (I'm not sure) that Cordova must be loaded at the beginning. When it is loaded at the end of the page, the pause/resume
events are not triggered.
Indeed, the deviceready
's Cordova event is special in that, any event handler registered after the deviceready
event fires has its callback function called immediately.
Reference : https://cordova.apache.org/docs/en/5.4.0/cordova/events/events.deviceready.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.