data-role="panel"
attribute to to a <div>
element in order to create jQuery Mobile Panels and specify the respective id. Inside <div> tag, add HTML markup that has to be displayed in the Panel.
The below code must be placed before or after the data-roles
of jQuery Mobile page i.e header, content and footer.
[html]
<div data-role="panel" id="panel1">
<h2>Header</h2>
<p>Text to display</p>
</div>
[/html]
<div>
panel that has attribute data-rel="close"
. Also specify the href
attribute to refer page id that has to be displayed while closing the panel.
Eg:
[html]
<div data-role="panel" id="panel1">
<h2>Header</h2>
<p>Text to display</p>
<a href="#info" data-rel="close" class="ui-btn ui-btn-inline">Close</a>
</div>
[/html] Attribute | Value | Description |
---|---|---|
data-dismissible | true | false | It checks if the panel can be closed or not when clicked outside of it. |
data-swipe-close | true | false | It checks if the panel is closed or not by swiping. |
data-display
attribute.
Attribute Value | Description |
---|---|
data-display="overlay" | Panel is displayed over the content when used this attribute. |
data-display="push" | Used to animate the page and the panel simultaneously. |
data-display="reveal" | This is a default attribute.The panel will be below the page and are shown when the page moves away. |
data-position="right"
attribute.
Eg:
[html]<div data-role="panel" id="panel1" data-position="right">[/html]
Position of the panel content can also be specified as per rest of the page when a user begins scrolling. The panel scrolls along with the page by default (but the panel's content will stay on top of the page). In order to display the panel content, even it is far from page which is being scrolled, add the attribute data-position-fixed="true"
to the panel.
Eg:
[html]<div data-role="panel" id="panel1" data-position-fixed="true">[/html]