Skip to content

Commit

Permalink
since we're not using silentScroll, manually disable scrollstart list…
Browse files Browse the repository at this point in the history
…ening during scroll to match its behavior
  • Loading branch information
scottjehl committed Mar 29, 2012
1 parent 7acaad8 commit 5560911
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions js/jquery.mobile.transition.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ var createHandler = function( sequential ){
toggleViewportClass = function(){ toggleViewportClass = function(){
$.mobile.pageContainer.toggleClass( "ui-mobile-viewport-transitioning viewport-" + name ); $.mobile.pageContainer.toggleClass( "ui-mobile-viewport-transitioning viewport-" + name );
}, },
scrollPage = function(){
// By using scrollTo instead of silentScroll, we can keep things better in order
// Just to be precautios, disable scrollstart listening like silentScroll would
$.event.special.scrollstart.enabled = false;

window.scrollTo( 0, toScroll );

// reenable scrollstart listening like silentScroll would
setTimeout(function() {
$.event.special.scrollstart.enabled = true;
}, 150 );
},
cleanFrom = function(){ cleanFrom = function(){
$from $from
.removeClass( $.mobile.activePageClass + " out in reverse " + name ) .removeClass( $.mobile.activePageClass + " out in reverse " + name )
Expand Down Expand Up @@ -68,8 +80,7 @@ var createHandler = function( sequential ){
// Set to page height // Set to page height
$to.height( screenHeight + toScroll ); $to.height( screenHeight + toScroll );


// By using scrollTo instead of silentScroll, we can keep things better in order scrollPage();
window.scrollTo( 0, toScroll );


if( !none ){ if( !none ){
$to.animationComplete( doneIn ); $to.animationComplete( doneIn );
Expand Down Expand Up @@ -101,7 +112,7 @@ var createHandler = function( sequential ){
// In some browsers (iOS5), 3D transitions block the ability to scroll to the desired location during transition // In some browsers (iOS5), 3D transitions block the ability to scroll to the desired location during transition
// This ensures we jump to that spot after the fact, if we aren't there already. // This ensures we jump to that spot after the fact, if we aren't there already.
if( $( window ).scrollTop() !== toScroll ){ if( $( window ).scrollTop() !== toScroll ){
window.scrollTo( 0, toScroll ); scrollPage();
} }


deferred.resolve( name, reverse, $to, $from, true ); deferred.resolve( name, reverse, $to, $from, true );
Expand Down

0 comments on commit 5560911

Please sign in to comment.