Permalink
Browse files

[popup] Record window offset when acquiring nav hook and scroll to it…

… after the popup has been closed
  • Loading branch information...
1 parent f2a50a1 commit 5cc972316278506dde3a0a0071ea1c9965971f69 @gabrielschulhof gabrielschulhof committed Aug 13, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 js/widgets/popup.js
View
@@ -654,6 +654,7 @@ define( [ "jquery",
if ( $.mobile.urlHistory.activeIndex === 0 && dstHash === $.mobile.urlHistory.initialDst ) {
dstHash += $.mobile.dialogHashKey;
}
+ this._lastScroll = windowCoords();
$.mobile.urlHistory.ignoreNextHashChange = currentIsDialog;
$.mobile.urlHistory.addNew( dstHash, dstTransition, activeEntry.title, activeEntry.pageUrl, activeEntry.role );
$.mobile.path.set( dstHash );
@@ -714,6 +715,7 @@ define( [ "jquery",
},
_onHashChange: function( immediate ) {
+ var self = this;
this._abort = immediate;
if ( this._currentlyOpenPopup ) {
@@ -727,6 +729,9 @@ define( [ "jquery",
this._currentlyOpenPopup._immediate();
}
}
+ setTimeout( function() {
+ window.scrollTo( self._lastScroll.x, self._lastScroll.y );
+ }, 200 );
}
};

0 comments on commit 5cc9723

Please sign in to comment.