Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Popup: Record scrollTop upon open and close, and restore it upon hash…

…change. Fixes #5334.
  • Loading branch information...
commit b243436f67b7e58339b42e58d855bb1921339e78 1 parent 7e8ea36
@gabrielschulhof gabrielschulhof authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 js/widgets/popup.js
View
6 js/widgets/popup.js
@@ -188,6 +188,7 @@ define( [ "jquery",
// Define instance variables
$.extend( this, {
+ _scrollTop: 0,
_page: thisPage,
_ui: ui,
_fallbackTransition: "",
@@ -708,6 +709,8 @@ define( [ "jquery",
_closePopup: function( e, data ) {
var parsedDst, toUrl;
+ window.scrollTo( 0, this._scrollTop );
+
if ( e.type === "pagebeforechange" && data ) {
// Determine whether we need to rapid-close the popup, or whether we can
// take the time to run the closing transition
@@ -755,6 +758,7 @@ define( [ "jquery",
// set the global popup mutex
$.mobile.popup.active = this;
+ this._scrollTop = $( window ).scrollTop();
// if history alteration is disabled close on navigate events
// and leave the url as is
@@ -821,6 +825,8 @@ define( [ "jquery",
return;
}
+ this._scrollTop = $( window ).scrollTop();
+
if( this.options.history ) {
$.mobile.back();
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.