Skip to content

Commit adfcec2

Browse files
author
Gabriel Schulhof
committed
Popup: Document generated IDs
1 parent 5ab70a8 commit adfcec2

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

entries/popup.xml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<title>Popup Widget</title>
55
<desc>Opens content in a popup.</desc>
66
<longdesc>
7-
<h2>Popups</h2>
7+
<h2 id="popups">Popups</h2>
88
<p>To create a popup, add the <code>data-role="popup"</code> attribute to a div with the popup contents. Then create a link with the <code>href</code> set to the <code>id</code> of the popup div, and add the attribute <code>data-rel="popup"</code> to tell the framework to open the popup when the link is tapped. This is a similar markup pattern to the <a href="../dialog/">dialog</a> widget. A popup div has to be nested inside the same page as the link.</p>
99

1010
<pre><code><![CDATA[
@@ -26,7 +26,7 @@
2626
<iframe src="/resources/popup/example2.html" style="width:100%;height:590px;border:0px"></iframe>
2727
</p>
2828

29-
<h2>Scaling images: Lightbox examples</h2>
29+
<h2 id="scaling-images-lightbox-examples">Scaling images: Lightbox examples</h2>
3030

3131
<p>The framework CSS contains rules that make images that are immediate children of the popup scale to fit the screen. Because of the absolute positioning of the popup container and screen, the height is not adjusted to screen height on all browsers. You can prevent vertical scrolling with a simple script that sets the <code>max-height</code> of the image.</p>
3232

@@ -47,7 +47,7 @@ $( document ).on( "pagecreate", function() {
4747
});
4848
]]></code></pre>
4949

50-
<h2>Working with iframes in popups</h2>
50+
<h2 id="working-with-iframes-in-popups">Working with iframes in popups</h2>
5151

5252
<p>You may need to embed an iframe into a popup to use a 3rd party widget. Here, we'll walk through a few real-world examples of working with iframes: videos and maps.</p>
5353

@@ -397,6 +397,36 @@ $( document ).on( "pageinit", function() {
397397

398398
<iframe src="/resources/popup/example13.html" style="width:100%;height:390px;border:0px"></iframe>
399399

400+
<h2 id="id-generation">ID generation</h2>
401+
402+
<p>The <placeholder name="name"/> widget adds an ID to the elements it generates. The ID for any given generated element is constructed by suffixing the popup's own ID:</p>
403+
<dl>
404+
<dt>Placeholder</dt>
405+
<dd><code><strong><![CDATA[<popup-id>]]></strong></code>-placeholder</dd>
406+
<dt>Screen</dt>
407+
<dd><code><strong><![CDATA[<popup-id>]]></strong></code>-screen</dd>
408+
<dt>Container</dt>
409+
<dd><code><strong><![CDATA[<popup-id>]]></strong></code>-popup</dd>
410+
</dl>
411+
<p>For example, creating a <placeholder name="name"/> with</p>
412+
<pre><code><![CDATA[
413+
<div id="extra-info" data-role="popup">
414+
<p>To use this feature, enable it from Settings.</p>
415+
</div>
416+
]]></code></pre>
417+
<p>will result in the following markup:</p>
418+
<pre><code><![CDATA[
419+
<div id="extra-info-placeholder" style="display: none;">
420+
<!-- placeholder for extra-info -->
421+
</div>
422+
<div id="extra-info-screen" class="ui-screen-hidden ui-popup-screen ui-overlay-inherit"></div>
423+
<div id="extra-info-popup" class="ui-popup-container ui-popup-hidden ui-popup-truncate">
424+
<div id="extra-info" data-role="popup" class="ui-popup ui-body-inherit ui-overlay-shadow ui-corner-all">
425+
<p>To use this feature, enable it from Settings.</p>
426+
</div>
427+
</div>
428+
]]></code></pre>
429+
400430
</longdesc>
401431
<added>1.2</added>
402432
<options>

0 commit comments

Comments
 (0)