javascript - jQuery Mobile - why bind defaults to mobileinit? -


i'm using jquery mobile , want turn of ajax handling because funky stuff page. started with

<script src="jquery..."></script> <script src="jquerymobile..."></script> other stuff... own code: <script src="config.js"></script> other javascript files... 

my idea define global stuff libraries @ top, , specifics @ bottom rendered later , "overwrite" global properties. example, own css override jquery's css, , config file do:

$.mobile.ajaxenabled = false; 

which disabled ajax handling.

however, http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html says overwrite defaults in config file before jquery mobile src'd, funky notation: (from page)

<script src="jquery.js"></script> <script src="custom-scripting.js"></script> <script src="jquery-mobile.js"></script>  //custom-scripting.js $(document).bind("mobileinit", function(){   $.extend(  $.mobile , {     foo: bar   }); }); 

my question why when can include one-liner $.mobile.ajaxenabled = false; in config file after jquery-mobile.js? assume it's javascript's paradigm/style , not, don't see why have go through trouble.

so, 1 better use , why? why documentation recommend way?

edit: , documentation says mobileinit called immediately, should safe modifying $.mobile object later in config file right?

i think found why. jquery mobile initialise himself , defines (= overwrites) $.mobile variable without worrying whether set first. that's explains mobileinit hook allow modification.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -