diff --git a/js/jquery.mobile.dialog.js b/js/jquery.mobile.dialog.js index 23902b6a..38535c6d 100644 --- a/js/jquery.mobile.dialog.js +++ b/js/jquery.mobile.dialog.js @@ -60,10 +60,15 @@ $.widget( "mobile.dialog", $.mobile.widget, { .attr( "data-" + $.mobile.ns + "direction", "reverse" ); } }) - .bind( "pagehide", function() { + .bind( "pagehide", function( e, ui ) { $( this ).find( "." + $.mobile.activeBtnClass ).removeClass( $.mobile.activeBtnClass ); + + // if there's an overlay theme, we're going to remove it from the page container. + // First though, check that the incoming page isn't a dialog with the same theme. If so, don't remove. if( self.options.overlayTheme ){ - $.mobile.pageContainer.removeClass( "ui-body-" + self.options.overlayTheme ); + if( !ui.nextPage || !ui.nextPage.is( ".ui-dialog-page.ui-overlay-" + self.options.overlayTheme ) ){ + $.mobile.pageContainer.removeClass( "ui-overlay-" + self.options.overlayTheme ); + } } }) .bind( "pagebeforeshow", function(){