Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Navigation: wait for DOM ready in addition to nav ready before listen…
Browse files Browse the repository at this point in the history
…ing for "navigate" events
  • Loading branch information
Gabriel Schulhof committed Dec 11, 2012
1 parent d74133c commit 2f25782
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js/jquery.mobile.navigation.js
Expand Up @@ -26,6 +26,9 @@ define( [
//will be defined when a link is clicked and given an active class
$activeClickedLink = null,

// resolved on domready
domreadyDeferred = $.Deferred(),

//urlHistory is purely here to make guesses at whether the back or forward button was clicked
//and provide an appropriate transition
urlHistory = $.navigate.history,
Expand Down Expand Up @@ -1271,7 +1274,10 @@ define( [
$( window ).bind( "throttledresize", resetActivePageHeight );

};//navreadyDeferred done callback
$.mobile.navreadyDeferred.done( function() { $.mobile._registerInternalEvents(); } );

$( function() { domreadyDeferred.resolve(); } );

$.when( domreadyDeferred, $.mobile.navreadyDeferred ).done( function() { $.mobile._registerInternalEvents(); } );

})( jQuery );
//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
Expand Down

0 comments on commit 2f25782

Please sign in to comment.