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

Commit

Permalink
Transition: do not set page focus on inital load to prevent jumping p…
Browse files Browse the repository at this point in the history
…ages when in iframes
  • Loading branch information
arschmitz committed Aug 12, 2013
1 parent 85d3158 commit b332bcd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions js/transitions/transition.js
Expand Up @@ -63,9 +63,9 @@ define( [ "jquery",
this.deferred.resolve( this.name, this.reverse, this.$to, this.$from, true );
},

doneOut: function( screenHeight, reverseClass, none ) {
doneOut: function( screenHeight, reverseClass, none, preventFocus ) {
this.beforeDoneOut();
this.startIn( screenHeight, reverseClass, none );
this.startIn( screenHeight, reverseClass, none, preventFocus );
},

hideIn: function( callback ) {
Expand All @@ -90,12 +90,14 @@ define( [ "jquery",
}, 150 );
},

startIn: function( screenHeight, reverseClass, none ) {
startIn: function( screenHeight, reverseClass, none, preventFocus ) {
this.hideIn(function() {
this.$to.addClass( $.mobile.activePageClass + this.toPreClass );

// Send focus to page as it is now display: block
$.mobile.focusPage( this.$to );
if( !preventFocus ){
$.mobile.focusPage( this.$to );
}

// Set to page height
this.$to.height( screenHeight + this.toScroll );
Expand Down Expand Up @@ -153,7 +155,7 @@ define( [ "jquery",
if ( this.$from && !none ) {
this.startOut( screenHeight, reverseClass, none );
} else {
this.doneOut( screenHeight, reverseClass, none );
this.doneOut( screenHeight, reverseClass, none, true );
}

return this.deferred.promise();
Expand Down

0 comments on commit b332bcd

Please sign in to comment.