Skip to content

Commit

Permalink
Panel: Retain current page during closing process
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Dec 16, 2014
1 parent 2ef45a1 commit 3c99b4e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions js/widgets/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,10 @@ $.widget( "mobile.panel", {
close: function( immediate ) {
if ( this._open ) {
var self = this,

// Record what the page is the moment the process of closing begins, because it
// may change by the time the process completes
currentPage = self._page(),
o = this.options,

_closePanel = function() {
Expand All @@ -405,13 +409,14 @@ $.widget( "mobile.panel", {
},
complete = function() {
if ( o.theme && o.display !== "overlay" ) {
self._page().parent().removeClass( o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme );
currentPage.parent().removeClass( o.classes.pageContainer + "-themed " +
o.classes.pageContainer + "-" + o.theme );
}

self.element.addClass( o.classes.panelClosed );

if ( o.display !== "overlay" ) {
self._page().parent().removeClass( o.classes.pageContainer );
currentPage.parent().removeClass( o.classes.pageContainer );
self._wrapper.removeClass( o.classes.pageContentPrefix + "-open" );
self._fixedToolbars().removeClass( o.classes.pageContentPrefix + "-open" );
}
Expand All @@ -425,7 +430,7 @@ $.widget( "mobile.panel", {
self._unbindFixListener();
$.mobile.resetActivePageHeight();

self._page().jqmRemoveData( "panel" );
currentPage.jqmRemoveData( "panel" );

self._trigger( "close" );

Expand Down

0 comments on commit 3c99b4e

Please sign in to comment.