Permalink
Browse files

switched the order up a little and added a class during transition in…

… attempt to precache the dom
  • Loading branch information...
scottjehl
scottjehl committed Feb 3, 2011
1 parent 2d96d5b commit 28e3cbeb6b7b5ed0d3478d329082bcb4de00643f
Showing with 16 additions and 4 deletions.
  1. +11 −4 js/jquery.mobile.navigation.js
  2. +5 −0 themes/default/jquery.mobile.transitions.css
@@ -345,11 +345,12 @@
//function for transitioning between two existing pages
function transitionPages() {
-
//get current scroll distance
var currScroll = $window.scrollTop(),
perspectiveTransitions = [ "flip" ],
pageContainerClasses = [];
+
+ window.scrollTo(0,0);
//support deep-links to generated sub-pages
if( url.indexOf( "&" + $.mobile.subPageUrlKey ) > -1 ){
@@ -382,13 +383,19 @@
//if there's a scrollTop from visiting the page already, scroll to it
var lastScroll = to.data( "lastScroll" ) || 0,
- scrollObj = "scrollTop" in document.body && "body" || "scrollTop" in document.documentElement && "html";
+ scrollObj = "scrollTop" in document.body && "body" || "scrollTop" in document.documentElement && "html",
+ scrollClass = "ui-mobile-viewport-scrolling";
+
+ addContainerClass( scrollClass );
if( scrollObj && lastScroll && $.mobile.smoothScroll ){
- $( scrollObj ).animate( { scrollTop : lastScroll }, 500 );
+ $( scrollObj ).animate( { scrollTop : lastScroll }, 800, function(){
+ $.mobile.pageContainer.removeClass( scrollClass );
+ } );
}
else{
- $.mobile.silentScroll( lastScroll );
+ window.scrollTo(0, lastScroll);
+ $.mobile.pageContainer.removeClass( scrollClass );
}
reFocus( to );
@@ -163,6 +163,11 @@ Built by David Kaneda and maintained by Jonathan Stark.
overflow: hidden;
}
+.ui-mobile-viewport-scrolling,
+.ui-mobile-viewport-scrolling .ui-page {
+ -webkit-backface-visibility: hidden;
+}
+
.flip {
-webkit-animation-duration: .65s;
-webkit-backface-visibility:hidden;

0 comments on commit 28e3cbe

Please sign in to comment.