diff --git a/demos/widgets/panels/external-2.php b/demos/widgets/panels/external-2.php new file mode 100644 index 00000000000..a313585c408 --- /dev/null +++ b/demos/widgets/panels/external-2.php @@ -0,0 +1,79 @@ + + + + + + Panels - jQuery Mobile Demos + + + + + + + + + + +
+ + +
+ +

Default panel options

+

This panel has all the default options: positioned on the left with the reveal display mode. The panel markup is before the header, content and footer in the source order.

+

To close, click off the panel, swipe left or right, hit the Esc key, or use the button below:

+ Close panel + +
+ + + +
+

jQuery Mobile Framework

+ Navigation + Search + +
+ +
+ +

External Panels Page 2API

+ +

Flexible by design, panels can be used for navigation, forms, inspectors and more.

+ +

External Panels - These panels only exist if you navigated here from page 1. to try this refresh the page and try the links they will not work.

+ +

The panels below are all located outside the page

+ +

Left panel examples

+ Overlay + Reveal + Push + +

Right panel examples

+ Overlay + Reveal + Push + +
+ + + + + + + + + + +
+ + diff --git a/demos/widgets/panels/external.php b/demos/widgets/panels/external.php new file mode 100644 index 00000000000..6bb6725894c --- /dev/null +++ b/demos/widgets/panels/external.php @@ -0,0 +1,260 @@ + + + + + + Panels - jQuery Mobile Demos + + + + + + + + + + +
+ + +
+ +

Default panel options

+

This panel has all the default options: positioned on the left with the reveal display mode. The panel markup is before the header, content and footer in the source order.

+

To close, click off the panel, swipe left or right, hit the Esc key, or use the button below:

+ Close panel + +
+ + + +
+

jQuery Mobile Framework

+ Navigation + Search + +
+ +
+ +

External Panels API

+ +

Flexible by design, panels can be used for navigation, forms, inspectors and more.

+ +

External Panels

+ +

The panels below are all located outside the page. Panels outside of a page must be initalized manually and will not be handled by auto init

+

Panels outside of pages will remain in the dom unless manually removed and can be opened or closed from any page

+

Navigate to page to below to see this behivor. This page has no panels in it

+ +

Navigate to page 2

+ +

Left panel examples

+ Overlay + Reveal + Push + +

Right panel examples

+ Overlay + Reveal + Push + +

The position of the panel on the screen is set by the data-position attribute. The default value of the attribute is left, meaning it will appear from the left edge of the screen. Specify data-position="right" for it to appear from the right edge instead.

+ +

The display mode of the panel is set by the data-display attribute. The value of the attribute defaults to reveal, meaning the panel will sit under the page and reveal as the page slides away. Specify data-display="overlay" for the panel to appear on top of the page contents. A third mode, data-display="push" animates both the panel and page at the same time.

+ +

Where panel markup goes in the markup

+ +

A panel must be a sibling to the header, content and footer elements inside a jQuery Mobile page. You can add the panel markup either before or after these elements, but not in between. A panel cannot be placed outside a page, but this constraint will be removed in a future version.

+ +

Here is an example of the panel before the header, content and footer in the source order:

+ +

+<div data-role="page">
+
+<div data-role="panel" id="mypanel">
+    <!-- panel content goes here -->
+</div><!-- /panel -->
+
+<!-- header -->
+<!-- content -->
+<!-- footer -->
+
+</div><!-- page -->
+
+ +

Alternatively, it's possible to add the panel markup after the header, content and footer in the source order, just before the end of the page container. Where in the source order you place the panel markup will depend on how you want the page content to read for people experiencing the page on a C-grade device (HTML only) or for a screen reader.

+ +

Dynamic content

+ +

When you dynamically add content to a panel or make hidden content visible while the panel is open, you have to trigger the updatelayout event on the panel.

+ +

+$( "#mypanel" ).trigger( "updatelayout" );
+
+ +

The framework will then check the new height of the panel contents. If it exceeds the screen height, it will set the page min-height to this height and unfix panels with data-position-fixed="true". See also Panel positioning.

+ +

Opening a panel

+ +

To control a panel from a link, set the href to the ID of the panel you want to toggle (mypanel in the example above). This instructs the framework to bind the link to the panel. This link will toggle the visibility of the panel so tapping it will open the panel, and tapping it again will close it.

+ + Default panel + +

Closing a panel

+ +

Clicking the link that opened the panel, swiping left or right, or tapping the Esc key will close the panel. To turn off the swipe-to-close behavior, add the data-swipe-close="false" attribute to the panel.

+ +

By default, panels can also be closed by clicking outside the panel onto the page contents. To prevent this behavior, add the data-dismissible="false" attribute to the panel. It's possible to have the panel and page sit side-by-side at wider screen widths and prevent the click-out-to-close behavior only above a certain screen width by applying a media query. See the responsive section below for details.

+ +

It's common to also add a close button inside the panel. To add the link that will close the panel, add the data-rel="close" attribute to tell the framework to close that panel when clicked. It's important to ensure that this link also makes sense if JavaScript isn't available, so we recommend that the href point to the ID of the page to which the user should jump when closing. For example, if the button to open the panel is in the header bar that has and ID of my-header, the close link in the panel should be:

+ +

+<a href="#my-header" data-rel="close">Close panel</a>
+
+ +

Panel animations

+ +

Panels will animate if the browser supports 3D transforms — the same criteria for CSS animation support we use for page transitions. Panel animations use translate3d(x,y,z) CSS transforms to ensure they are hardware accelerated and smooth.

+ +

The animate option allows you to turn off panel animations for all devices. To turn off animations via markup, add the data-animate="false" attribute to the panel container.

+ +

Panel positioning

+ +

The panel will be displayed with the position:absolute CSS property, meaning it will scroll with the page. When a panel is opened the framework checks to see if the bottom of the panel contents is in view. If not, it scrolls to the top of the page.

+ +

You can set a panel to position:fixed, so its contents will appear no matter how far down the page you're scrolled, by adding the data-position-fixed="true" attribute to the panel. The framework also checks to see if the panel contents will fit within the viewport before applying the fixed positioning because this property would prevent the panel contents from scrolling and make it inaccessible. overflow is not well supported enough to use at this time. If the panel contents are too long to fit within the viewport, the framework will simply display the panel without fixed positioning. See an example of panels with fixed positioning.

+ +

Styling panels

+ +

By default, panels have very simple styles to let you customize them as needed. Panels are essentially just simple blocks with no margins that sit on either side of the page content. The framework wraps the panel content in a div with class ui-panel-inner which has a padding of 15 pixels. If needed you can override this with custom CSS or use option classes.panelInner to set a different class name for the div.

+ +

Panels have a fixed width of 17em (272 pixels) which is narrow enough to still show some of the page contents when open to make clicking out to close easy, while still looking good on wider tablet or desktop screens. The styles to set widths on panels are fairly complex but these can be overridden with CSS as needed.

+ +

Other than the theme background, width and 100% height styles, panels have very little styling on their own. The default theme for panels is "c". You can set a different theme for the panel by adding a data-theme attribute to the panel container, or you can set data-theme="none" and add your own classes to style it as needed.

+ +

Note that adding padding, borders, or margins directly to the panel container will alter the overall dimensions and could cause the positioning and animation to be affected. To avoid this, apply styles to the panel content wrapper (.ui-panel-inner).

+ +

Making the panel responsive

+ +

When the push or reveal display is used, a panel pushes the page aside when it opens. Since some of the page is pushed offscreen, the panel is modal and must be closed to interact with the page content again. On larger screens, you may want to have the panel work more like a collapsible column that can be opened and used alongside the page to make better use of the screen real estate.

+

To make the page work alongside the open panel, it needs to re-flow to a narrower width so it will fit next to the panel. This can be done purely with CSS by adding a left or right margin equal to the panel width (17em) to the page contents to force a re-flow. Second, the invisible layer placed over the page for the click-out-to-dismiss behavior is hidden with CSS so you can click on the page and not close the menu.

+

Here is an example of these rules wrapped in a media query to only apply this behavior above 35em (560px):

+ +

+@media (min-width:35em){
+
+	/* wrap on wide viewports once open */
+	
+	.ui-page-panel-open .ui-panel-content-fixed-toolbar-display-push.ui-panel-content-fixed-toolbar-position-left,
+	.ui-page-panel-open .ui-panel-content-fixed-toolbar-display-reveal.ui-panel-content-fixed-toolbar-position-left,
+	.ui-page-panel-open .ui-panel-content-wrap-display-push.ui-panel-content-wrap-position-left,
+	.ui-page-panel-open .ui-panel-content-wrap-display-reveal.ui-panel-content-wrap-position-left {
+		margin-right: 17em;
+	}
+	.ui-page-panel-open .ui-panel-content-fixed-toolbar-display-push.ui-panel-content-fixed-toolbar-position-right,
+	.ui-page-panel-open .ui-panel-content-fixed-toolbar-display-reveal.ui-panel-content-fixed-toolbar-position-right,
+	.ui-page-panel-open .ui-panel-content-wrap-display-push.ui-panel-content-wrap-position-right,
+	.ui-page-panel-open .ui-panel-content-wrap-display-reveal.ui-panel-content-wrap-position-right {
+		margin-left: 17em;
+	}
+	.ui-page-panel-open .ui-panel-content-fixed-toolbar-display-push,
+	.ui-page-panel-open .ui-panel-content-fixed-toolbar-display-reveal {
+		width: auto;
+	}
+	
+	/* disable "dismiss" on wide viewports */
+	.ui-panel-dismiss {
+		display: none;
+	}
+	/* same as the above but for panels with display mode "push" only */
+	.ui-panel-dismiss-display-push {
+		display: none;
+	}
+
+}
+
+ +

Applying a preset breakpoint

+ +

Included in the widget styles is a breakpoint preset for this behavior that kicks in at 55em (880px). This breakpoint is not applied by default to make it easier for you to write custom breakpoints that work best for your content and design. To apply the breakpoint preset, add the ui-responsive-panel class to the page wrapper (not the panel). See an example of a responsive panel page.

+ +
+ + + + + + + + + + +
+
+ +

Left Panel: Reveal

+

This panel is positioned on the left with the reveal display mode. The panel markup is after the header, content and footer in the source order.

+

To close, click off the panel, swipe left or right, hit the Esc key, or use the button below:

+ Close panel + +
+ + +
+ +

Left Panel: Push

+

This panel is positioned on the left with the push display mode. The panel markup is after the header, content and footer in the source order.

+

To close, click off the panel, swipe left or right, hit the Esc key, or use the button below:

+ Close panel + +
+ + +
+ +

Left Panel: Overlay

+

This panel is positioned on the left with the overlay display mode. The panel markup is after the header, content and footer in the source order.

+

To close, click off the panel, swipe left or right, hit the Esc key, or use the button below:

+ Close panel + +
+ + +
+ +

Right Panel: Reveal

+

This panel is positioned on the right with the reveal display mode. The panel markup is after the header, content and footer in the source order.

+

To close, click off the panel, swipe left or right, hit the Esc key, or use the button below:

+ Close panel + +
+ + +
+ +

Right Panel: Push

+

This panel is positioned on the right with the push display mode. The panel markup is after the header, content and footer in the source order.

+

To close, click off the panel, swipe left or right, hit the Esc key, or use the button below:

+ Close panel + +
+ + +
+ +

Right Panel: Overlay

+

This panel is positioned on the right with the overlay display mode. The panel markup is after the header, content and footer in the source order.

+

To close, click off the panel, swipe left or right, hit the Esc key, or use the button below:

+ Close panel + +
+ + diff --git a/demos/widgets/panels/index.php b/demos/widgets/panels/index.php index 9436303f961..52b45e7cdcf 100644 --- a/demos/widgets/panels/index.php +++ b/demos/widgets/panels/index.php @@ -172,6 +172,9 @@

Included in the widget styles is a breakpoint preset for this behavior that kicks in at 55em (880px). This breakpoint is not applied by default to make it easier for you to write custom breakpoints that work best for your content and design. To apply the breakpoint preset, add the ui-responsive-panel class to the page wrapper (not the panel). See an example of a responsive panel page.

+

Panels outside pages

+ +

As of 1.4 it is now possible to use panels outside of a page External Panels

-
- -

Left Panel: Overlay

-

This panel is positioned on the left with the overlay display mode. The panel markup is after the header, content and footer in the source order.

-

To close, click off the panel, swipe left or right, hit the Esc key, or use the button below:

- Close panel - -
+
@@ -244,5 +240,13 @@
+
+ +

Left Panel: Overlay

+

This panel is positioned on the left with the overlay display mode. The panel markup is after the header, content and footer in the source order.

+

To close, click off the panel, swipe left or right, hit the Esc key, or use the button below:

+ Close panel + +
diff --git a/js/widgets/panel.js b/js/widgets/panel.js index 151d3090917..9c4ef327773 100644 --- a/js/widgets/panel.js +++ b/js/widgets/panel.js @@ -47,84 +47,104 @@ $.widget( "mobile.panel", $.mobile.widget, { _fixedToolbar: null, _create: function() { - var self = this, - $el = self.element, - page = $el.closest( ":jqmData(role='page')" ), - _getPageTheme = function() { - var $theme = $.data( page[0], "mobile-page" ).options.theme, - $pageThemeClass = "ui-body-" + $theme; - return $pageThemeClass; - }, - _getPanelInner = function() { - var $panelInner = $el.find( "." + self.options.classes.panelInner ); - if ( $panelInner.length === 0 ) { - $panelInner = $el.children().wrapAll( "
" ).parent(); - } - return $panelInner; - }, - _getWrapper = function() { - var $wrapper = page.find( "." + self.options.classes.contentWrap ); - if ( $wrapper.length === 0 ) { - $wrapper = page.children( ".ui-header:not(:jqmData(position='fixed')), .ui-content:not(:jqmData(role='popup')), .ui-footer:not(:jqmData(position='fixed'))" ).wrapAll( "
" ).parent(); - if ( $.support.cssTransform3d && !!self.options.animate ) { - $wrapper.addClass( self.options.classes.animate ); - } - } - return $wrapper; - }, - _getFixedToolbar = function() { - var $fixedToolbar = page.find( "." + self.options.classes.contentFixedToolbar ); - if ( $fixedToolbar.length === 0 ) { - $fixedToolbar = page.find( ".ui-header:jqmData(position='fixed'), .ui-footer:jqmData(position='fixed')" ).addClass( self.options.classes.contentFixedToolbar ); - if ( $.support.cssTransform3d && !!self.options.animate ) { - $fixedToolbar.addClass( self.options.classes.animate ); - } - } - return $fixedToolbar; - }; + var $el = this.element, + page = $el.closest( ":jqmData(role='page')" ); // expose some private props to other methods $.extend( this, { _panelID: $el.attr( "id" ), _closeLink: $el.find( ":jqmData(rel='close')" ), - _page: $el.closest( ":jqmData(role='page')" ), - _pageTheme: _getPageTheme(), - _panelInner: _getPanelInner(), - _wrapper: _getWrapper(), - _fixedToolbar: _getFixedToolbar() + _page: ( page.length > 0 )? page: false, }); - - self._addPanelClasses(); - self._wrapper.addClass( this.options.classes.contentWrapClosed ); - self._fixedToolbar.addClass( this.options.classes.contentFixedToolbarClosed ); + $.extend( this, { + _pageTheme: this._getPageTheme(), + _panelInner: this._getPanelInner(), + _wrapper: this._getWrapper, + _fixedToolbar: this._getFixedToolbar() + }); + this._addPanelClasses(); + this._wrapper().addClass( this.options.classes.contentWrapClosed ); + this._fixedToolbar.addClass( this.options.classes.contentFixedToolbarClosed ); // add class to page so we can set "overflow-x: hidden;" for it to fix Android zoom issue - self._page.addClass( self.options.classes.pagePanel ); + $(".ui-page-active").addClass( this.options.classes.pagePanel ); // if animating, add the class to do so - if ( $.support.cssTransform3d && !!self.options.animate ) { - this.element.addClass( self.options.classes.animate ); + if ( $.support.cssTransform3d && !!this.options.animate ) { + this.element.addClass( this.options.classes.animate ); } - self._bindUpdateLayout(); - self._bindCloseEvents(); - self._bindLinkListeners(); - self._bindPageEvents(); + this._bindUpdateLayout(); + this._bindCloseEvents(); + this._bindLinkListeners(); + this._bindPageEvents(); - if ( !!self.options.dismissible ) { - self._createModal(); + if ( !!this.options.dismissible ) { + this._createModal(); } - self._bindSwipeEvents(); + this._bindSwipeEvents(); + }, + _getPageTheme: function() { + if( !!this._page ){ + var $theme = $.data( this._page[0], "mobile-page" ).options.theme, + $pageThemeClass = "ui-body-" + $theme; + } else { + $pageThemeClass = "ui-body-a"; + } + return $pageThemeClass; + }, + _getPanelInner: function() { + var $panelInner = this.element.find( "." + this.options.classes.panelInner ); + if ( $panelInner.length === 0 ) { + $panelInner = this.element.children().wrapAll( "
" ).parent(); + } + return $panelInner; + }, + _getWrapper: function() { + if( !!this._page ){ + var $wrapper = this._page.find( "." + this.options.classes.contentWrap ); + if ( $wrapper.length === 0 ) { + $wrapper = this._page.children( ".ui-header:not(:jqmData(position='fixed')), .ui-content:not(:jqmData(role='popup')), .ui-footer:not(:jqmData(position='fixed'))" ).wrapAll( "
" ).parent(); + if ( $.support.cssTransform3d && !!this.options.animate ) { + $wrapper.addClass( this.options.classes.animate ); + } + } + } else { + $wrapper = $(".ui-page-active"); + if ( $.support.cssTransform3d && !!this.options.animate ) { + $wrapper.addClass( this.options.classes.animate ); + } + } + return $wrapper; + }, + _getFixedToolbar: function() { + if( !!this._page ){ + var $fixedToolbar = this._page.find( "." + this.options.classes.contentFixedToolbar ); + if ( $fixedToolbar.length === 0 ) { + $fixedToolbar = this._page.find( ".ui-header:jqmData(position='fixed'), .ui-footer:jqmData(position='fixed')" ).addClass( this.options.classes.contentFixedToolbar ); + if ( $.support.cssTransform3d && !!this.options.animate ) { + $fixedToolbar.addClass( this.options.classes.animate ); + } + } + } else { + $fixedToolbar = $(".ui-page-active").find( ".ui-header:jqmData(position='fixed'), .ui-footer:jqmData(position='fixed')" ).addClass( this.options.classes.contentFixedToolbar ); + if ( $.support.cssTransform3d && !!this.options.animate ) { + $fixedToolbar.addClass( this.options.classes.animate ); + } + } + return $fixedToolbar; }, - _createModal: function() { - var self = this; + var self = this, + target = (!!this._page)? this._page:$("body"); + + self._modal = $( "
" ) .on( "mousedown", function() { self.close(); }) - .appendTo( this._page ); + .appendTo( target ); }, _getPosDisplayClasses: function( prefix ) { @@ -217,7 +237,7 @@ $.widget( "mobile.panel", $.mobile.widget, { _bindLinkListeners: function() { var self = this; - self._page.on( "click.panel" , "a", function( e ) { + $.mobile.document.on( "click.panel" , "a", function( e ) { if ( this.href.split( "#" )[ 1 ] === self._panelID && self._panelID !== undefined ) { e.preventDefault(); var $link = $( this ), @@ -260,21 +280,21 @@ $.widget( "mobile.panel", $.mobile.widget, { _bindPageEvents: function() { var self = this; - self._page + $.mobile.document // Close the panel if another panel on the page opens - .on( "panelbeforeopen", function( e ) { + .on( "panelbeforeopen","[data-role='page']", function( e ) { if ( self._open && e.target !== self.element[ 0 ] ) { self.close(); } }) // clean up open panels after page hide - .on( "pagehide", function(/* e */) { + .on( "pagehide","[data-role='page']", function(/* e */) { if ( self._open ) { self.close( true ); } }) // on escape, close? might need to have a target check too... - .on( "keyup.panel", function( e ) { + .on( "keyup.panel","[data-role='page']", function( e ) { if ( e.keyCode === 27 && self._open ) { self.close(); } @@ -293,17 +313,17 @@ $.widget( "mobile.panel", $.mobile.widget, { var self = this, o = self.options, _openPanel = function() { - self._page.off( "panelclose" ); - self._page.jqmData( "panel", "open" ); + $(".ui-page-active").off( "panelclose" ); + $(".ui-page-active").jqmData( "panel", "open" ); if ( !immediate && $.support.cssTransform3d && !!o.animate ) { - self.element.add( self._wrapper ).on( self._transitionEndEvents, complete ); + self.element.add( self._wrapper() ).on( self._transitionEndEvents, complete ); } else { setTimeout( complete, 0 ); } if ( self.options.theme && self.options.display !== "overlay" ) { - self._page + $(".ui-page-active") .removeClass( self._pageTheme ) .addClass( "ui-body-" + self.options.theme ); } @@ -314,11 +334,11 @@ $.widget( "mobile.panel", $.mobile.widget, { // Fix for IE7 min-height bug if ( self.options.theme && self.options.display !== "overlay" ) { - self._wrapper.css( "min-height", self._page.css( "min-height" ) ); + self._wrapper().css( "min-height", $(".ui-page-active").css( "min-height" ) ); } self._contentWrapOpenClasses = self._getPosDisplayClasses( o.classes.contentWrap ); - self._wrapper + self._wrapper() .removeClass( o.classes.contentWrapClosed ) .addClass( self._contentWrapOpenClasses + " " + o.classes.contentWrapOpen ); @@ -333,9 +353,9 @@ $.widget( "mobile.panel", $.mobile.widget, { } }, complete = function() { - self.element.add( self._wrapper ).off( self._transitionEndEvents, complete ); + self.element.add( self._wrapper() ).off( self._transitionEndEvents, complete ); - self._page.addClass( o.classes.pagePanelOpen ); + $(".ui-page-active").addClass( o.classes.pagePanelOpen ); self._bindFixListener(); @@ -348,8 +368,8 @@ $.widget( "mobile.panel", $.mobile.widget, { self._trigger( "beforeopen" ); - if ( self._page.jqmData( "panel" ) === "open" ) { - self._page.on( "panelclose", function() { + if ( $(".ui-page-active").jqmData( "panel" ) === "open" ) { + $(".ui-page-active").on( "panelclose", function() { _openPanel(); }); } else { @@ -366,14 +386,14 @@ $.widget( "mobile.panel", $.mobile.widget, { self = this, _closePanel = function() { if ( !immediate && $.support.cssTransform3d && !!o.animate ) { - self.element.add( self._wrapper ).on( self._transitionEndEvents, complete ); + self.element.add( self._wrapper() ).on( self._transitionEndEvents, complete ); } else { setTimeout( complete, 0 ); } - self._page.removeClass( o.classes.pagePanelOpen ); + $(".ui-page-active").removeClass( o.classes.pagePanelOpen ); self.element.removeClass( o.classes.panelOpen ); - self._wrapper.removeClass( o.classes.contentWrapOpen ); + self._wrapper().removeClass( o.classes.contentWrapOpen ); self._fixedToolbar.removeClass( o.classes.contentFixedToolbarOpen ); if ( self._modal ) { @@ -382,14 +402,14 @@ $.widget( "mobile.panel", $.mobile.widget, { }, complete = function() { if ( self.options.theme && self.options.display !== "overlay" ) { - self._page.removeClass( "ui-body-" + self.options.theme ).addClass( self._pageTheme ); + $(".ui-page-active").removeClass( "ui-body-" + self.options.theme ).addClass( self._pageTheme ); // reset fix for IE7 min-height bug - self._wrapper.css( "min-height", "" ); + self._wrapper().css( "min-height", "" ); } - self.element.add( self._wrapper ).off( self._transitionEndEvents, complete ); + self.element.add( self._wrapper() ).off( self._transitionEndEvents, complete ); self.element.addClass( o.classes.panelClosed ); - self._wrapper + self._wrapper() .removeClass( self._contentWrapOpenClasses ) .addClass( o.classes.contentWrapClosed ); @@ -401,7 +421,7 @@ $.widget( "mobile.panel", $.mobile.widget, { self._unbindFixListener(); $.mobile.resetActivePageHeight(); - self._page.jqmRemoveData( "panel" ); + $(".ui-page-active").jqmRemoveData( "panel" ); self._trigger( "close" ); }; @@ -429,24 +449,24 @@ $.widget( "mobile.panel", $.mobile.widget, { // create if ( !hasOtherSiblingPanels ) { - this._wrapper.children().unwrap(); - this._page.find( "a" ).unbind( "panelopen panelclose" ); - this._page.removeClass( classes.pagePanel ); + this._wrapper().children().unwrap(); + $(".ui-page-active").find( "a" ).unbind( "panelopen panelclose" ); + $(".ui-page-active").removeClass( classes.pagePanel ); if ( this._open ) { - this._page.jqmRemoveData( "panel" ); - this._page.removeClass( classes.pagePanelOpen ); + $(".ui-page-active").jqmRemoveData( "panel" ); + $(".ui-page-active").removeClass( classes.pagePanelOpen ); if ( theme ) { - this._page.removeClass( "ui-body-" + theme ).addClass( this._pageTheme ); + $(".ui-page-active").removeClass( "ui-body-" + theme ).addClass( this._pageTheme ); } $.mobile.resetActivePageHeight(); } } else if ( this._open ) { - this._wrapper.removeClass( classes.contentWrapOpen ); + this._wrapper().removeClass( classes.contentWrapOpen ); this._fixedToolbar.removeClass( classes.contentFixedToolbarOpen ); - this._page.jqmRemoveData( "panel" ); - this._page.removeClass( classes.pagePanelOpen ); + $(".ui-page-active").jqmRemoveData( "panel" ); + $(".ui-page-active").removeClass( classes.pagePanelOpen ); if ( theme ) { - this._page.removeClass( "ui-body-" + theme ).addClass( this._pageTheme ); + $(".ui-page-active").removeClass( "ui-body-" + theme ).addClass( this._pageTheme ); } }