diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index ec4d72a5..72158554 100644 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -322,6 +322,7 @@ //function for transitioning between two existing pages function transitionPages() { + $.mobile.silentScroll(); //get current scroll distance var currScroll = $window.scrollTop(), @@ -341,9 +342,6 @@ to.data("page")._trigger("beforeshow", {prevPage: from}); function loadComplete(){ - $.mobile.pageLoading( true ); - - reFocus( to ); if( changeHash !== false && url ){ if( !back ){ @@ -360,8 +358,9 @@ removeActiveLinkClass(); - //jump to top or prev scroll, if set - $.mobile.silentScroll( to.data( 'lastScroll' ) ); + //jump to top or prev scroll, sometimes on iOS the page has not rendered yet. I could only get by this with a setTimeout, but would like to avoid that. + $.mobile.silentScroll( to.data( 'lastScroll' ) ); + reFocus( to ); //trigger show/hide events, allow preventing focus change through return false from.data("page")._trigger("hide", null, {nextPage: to}); @@ -391,16 +390,21 @@ if(transition && (transition !== 'none')){ + $.mobile.pageLoading( true ); if( $.inArray(transition, perspectiveTransitions) >= 0 ){ addContainerClass('ui-mobile-viewport-perspective'); } addContainerClass('ui-mobile-viewport-transitioning'); - // animate in / out - from.addClass( transition + " out " + ( reverse ? "reverse" : "" ) ); + /* animate in / out + * This is in a setTimeout because we were often seeing pages in not animate across but rather go straight to + * the 'to' page. The loadComplete would still fire, so the browser thought it was applying the animation. From + * what I could tell this was a problem with the classes not being applied yet. + */ + setTimeout(function() { from.addClass( transition + " out " + ( reverse ? "reverse" : "" ) ); to.addClass( $.mobile.activePageClass + " " + transition + - " in " + ( reverse ? "reverse" : "" ) ); + " in " + ( reverse ? "reverse" : "" ) ); } , 0); // callback - remove classes, etc to.animationComplete(function() { @@ -411,6 +415,7 @@ }); } else{ + $.mobile.pageLoading( true ); from.removeClass( $.mobile.activePageClass ); to.addClass( $.mobile.activePageClass ); loadComplete(); diff --git a/themes/default/jquery.mobile.transitions.css b/themes/default/jquery.mobile.transitions.css index de3c06a3..dab9247d 100644 --- a/themes/default/jquery.mobile.transitions.css +++ b/themes/default/jquery.mobile.transitions.css @@ -159,7 +159,8 @@ Built by David Kaneda and maintained by Jonathan Stark. .ui-mobile-viewport-transitioning, .ui-mobile-viewport-transitioning .ui-page { width: 100%; - height: 100%; + height: 120%; /* we want to make sure we take up enough to keep the scroll top hidden during transition, but not too much to overflow our buffer */ + overflow: hidden; } .flip {