You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>A panel consists of a container with a <code>data-role="panel"</code> attribute and a unique <code>ID</code>. This <code>ID</code> will be referenced by the link or button to open and close the panel. The most basic panel markup looks like this:</p>
<p>The <strong>position</strong> of the panel on the screen is set by the <code>data-position</code> attribute. The defaults to <code>left</code>, meaning it will appear from the left edge of the screen. Specify <code>data-position="right"</code> for it to appear from the right edge instead.</p>
97
105
98
-
<p>The <strong>display mode</strong> of the panel is set by the <code>data-display</code> attribute. The defaults to <code>overlay</code>, meaning the panel will appear to sit under the page and is revealed as the page slides away. Specify <code>data-display="overlay"</code> for it to appear on top of the page contents. A third mode, <code>data-display="push"</code>looks similar to reveal on smaller screens, but at wider widths, the panel slides in and causes the page contents to re-flow to make room so the panel can stay open, so it works like a dismissable column.</p>
106
+
<p>The <strong>display mode</strong> of the panel is set by the <code>data-display</code> attribute. The defaults to <code>overlay</code>, meaning the panel will appear on top of the page contents. Specify <code>data-display="reveal"</code> for the panel to sit under the page and reveal as the page slides away. A third mode, <code>data-display="push"</code>animates both the panel and page at the same time.</p>
99
107
100
108
<p>The overlay style panel will always be the smoothest and most reliable display mode, especially if combined with fixed toolbars so we recommend you use that mode if possible.</p>
109
+
110
+
<p>Here is an example of a panel with a custom position and display option set:</p>
<p>A panel's visibility is toggled by a link somewhere on the page or by calling the panel's <code>open</code> method directly.</p>
122
+
<p>A panel's visibility is toggled by a link somewhere on the page or by calling the panel's <code>open</code> method directly. The defaults place the panel on the left and will open over the page (overlay display mode). Open a panel programmatically like this:</p>
<p>This will create a link that opens our panel with the default options. The defaults place the panel on the left and will push the page over when it opens (reveal mode). </p>
126
+
120
127
121
-
<p>To control a panel from a link, point the <code>href</code> to references the <code>ID</code> of the panel you want to toggle (<code>mypanel</code> in the example above). This instructs the framework to bind the link to the popup. This link will toggle the visibility of the popup so tapping it will open the panel, and tapping it again will close it.</p>
128
+
<p>To control a panel from a link, point the <code>href</code> to references the <code>ID</code> of the panel you want to toggle (<code>mypanel</code> 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.</p>
<p>Clicking the link that opened the panel, swiping left or right, or tapping the Esc key will close the panel. </p>
149
+
<p>Clicking the link that opened the panel, swiping left or right, or tapping the Esc key will close the panel. To turn off the swipt o close behavior, add the <code>data-swipe-close="false"</code> attribute to the panel.</p>
140
150
141
-
<p>By default, panels can also be closed clicking outside the panel onto the page contents. To prevent this behavior, add the <code>data-dismissible="false"</code> attribute to the panel. Note the since the <code>push</code> mode is designed to have the panel and page to sit side-by-side at wider screen widths, the panel won't be dismissed by clicking on the page on larger screens, regardless of the dismissible settings.</p>
151
+
<p>By default, panels can also be closed clicking outside the panel onto the page contents. To prevent this behavior, add the <code>data-dismissible="false"</code> 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. </p>
142
152
143
153
<p>A panel can also be closed by calling the panel's <code>close</code> method directly.</p>
<p>It's common to also add a close button inside the panel. To add the link that will close the panel, add the <code>data-rel="close"</code> 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 <code>href</code> points to the ID of the page where the user should jump to when closing. For example, if the button to open the panel is in the heder bar that has and ID of <code>my-header</code>, the close link in the panel should be:</p>
157
+
<p>It's common to also add a close button inside the panel. To add the link that will close the panel, add the <code>data-rel="close"</code> 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 <code>href</code> points to the ID of the page where the user should jump to when closing. For example, if the button to open the panel is in the header bar that has and ID of <code>my-header</code>, the close link in the panel should be:</p>
<p>The framework has a feature test to detect if the required CSS properties are supported and will fall back to a simple hide/show if not available. After thorough testing, we decided to not animate panels on less capable platforms because the choppier animations weren't a better experience than a simple hide/show.</p>
159
169
160
-
<p>The <code>animate</code> option allows you to turn off panel animations for all devices. To turn off animations via markup, add the <code>data-animate="false"</code> attribute to the popup container.</p>
170
+
<p>The <code>animate</code> option allows you to turn off panel animations for all devices. To turn off animations via markup, add the <code>data-animate="false"</code> attribute to the panel container.</p>
161
171
162
172
163
173
<h2>Panel + fixed positioning</h2>
164
174
165
175
<p>The panel will be displayed with the <code>position:fixed</code> CSS property so their contents will appear no matter how far down the page you're scrolled. 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 using <code>overflow</code> is not well supported enough to use at this time.</p>
166
176
167
-
<p>If a browser doesn't support fixed positioning or if the panel contents are too long to fit within the viewport, the framework will simply display the panel without fixed positioning. If the user has scrolled down and opens a panel, they may need to scroll up to view the contents. </p>
177
+
<p>If a browser doesn't support fixed positioning or if the panel contents are too long to fit within the viewport, the framework will simply display the panel without fixed positioning. If the user has scrolled down and opens a panel, they may need to scroll up to view the contents. Fixed positioning can be disabled by adding the <code>data-position-fixed="false"</code> attribute to the panel.</p>
168
178
169
179
<p>In general, we recommend that you place the buttons that open the panel at the very top of the screen which is the most common UI pattern for panels. This will avoid the need to scroll and also makes the transitions a bit smoother.</p>
170
180
@@ -176,9 +186,10 @@ <h2>Styling panels</h2>
176
186
177
187
<p>By default, panels have very simple styles to let you customize them as needed. Panels are essentially just simple blocks with no padding or margins that sit on either side of the page content. </p>
178
188
179
-
<p>The framework does need to set a width in order for the CSS animations to work correctly so below 25ems (400px), the panel is set to 80% of the screen width. Above 400px, the panel has a max width of 20ems (320px) since that is a typical panel size. Unfortunately, the styles to set widths on panels are fairly complex but these can be overridden with CSS as needed.</p>
189
+
<p>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, and still looks 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.</p>
180
190
181
191
<p>Other than the width and 100% height styles, panels have very little styling on their own. You can set a theme on the panel by add a <code>data-theme</code> to the panel container or add your own classes to style it as needed.</p>
192
+
182
193
<p>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.</p>
183
194
184
195
<p>To add padding to a panel, we recommend adding a container inside the panel and applying styles to that to avoid any issues. All the examples on this page follow this pattern.</p>
@@ -210,95 +221,7 @@ <h4>Applying a preset breakpoint</h4>
210
221
<p>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 <code>ui-responsive-panel</code> class to the <em>page wrapper</em> (not the panel).</p>
211
222
212
223
213
-
<h2>Options</h2>
214
-
215
-
216
-
<dl>
217
-
218
-
<dt><code>animate</code> default: true</dt>
219
-
<dd>Sets whether the panel will animate when opening and closing. If set to false, the panel will just appear and disappear without animation. This is recommended for fastest performance. Also available via the <code>data-animate</code> attribute on the popup container.</dd>
220
-
221
-
<dt><code>dismissible</code> default: true</dt>
222
-
<dd>Sets whether the panel can be closed by clicking outside onto the page. Also available via the <code>data-dismissible</code> attribute on the link that opens the popup.</dd>
223
-
224
-
<dt><code>display</code> default: "overlay"</dt>
225
-
<dd>The relationship of the panel to the page contents. Can either push the page over ("reveal"), re-flow the content to fit the panel content as a column ("push"), or sit over the content ("overlay"). Also available via the <code>data-display</code> attribute on the link that opens the popup.</dd>
<dd>The role (or and valid jQuery selector) used to trigger auto-initialization of the panel widget.</dd>
229
-
230
-
<dt><code>position</code> default: "left"</dt>
231
-
<dd>The side of the screen the panel appears on. Values can be "left" or "right. Also available via the <code>data-position</code> attribute on the link that opens the popup.</dd>
232
-
233
-
<dt><code>theme</code> default: null</dt>
234
-
<dd>Theme swatch for the panel. Can be any valid swatch letter in your theme (a-z). Also available via the <code>data-theme</code> attribute on the popup container.</dd>
235
-
236
-
</dl>
237
-
238
-
<h3>Classes Option</h3>
239
-
<p>The <code>classes</code> option define the structural classnames that the plugin uses. This is only configurable via JavaScript because it expects an object literal value.</p>
<dd>Class added to the wrapper injected around the page contents (header, content, footer) when the panel is opening. Used for targeting hardware acceleration only during transitions.</dd>
0 commit comments