|
6 | 6 | <p>The jQuery Mobile <code>throttleresize</code> event is a special event that prevents browsers from running continuous callbacks on resize. <code>throttleresize</code> is used internally for orientationchange in browsers like Internet Explorer. <code>throttleresize</code> ensures that a held event will execute after the timeout so logic that depends on the final conditions after a resize is complete will still execute properly.</p>
|
7 | 7 | <p>The <code>throttleresize</code> event is triggered if orientationchange is not natively supported.</p>
|
8 | 8 | <p>This event triggers when the browser window resizes from:</p>
|
9 |
| - <ol> |
10 |
| - <li>an orientation change (orientation-enabled device);</li> |
11 |
| - <li>changes in dimension ratio that replicates a landspace/portrait change (resizing a desktop browser).</li> |
12 |
| - </ol> |
| 9 | + <ol> |
| 10 | + <li>an orientation change (orientation-enabled device);</li> |
| 11 | + <li>changes in dimension ratio that replicates a landspace/portrait change (resizing a desktop browser).</li> |
| 12 | + </ol> |
13 | 13 |
|
14 | 14 | <xi:include href="../includes/core-extension-desc.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
15 |
| - <pre> |
16 |
| - <code><![CDATA[ |
17 |
| - var count = 0; |
18 |
| - $(function() { |
19 |
| - /* |
20 |
| - Bind an event handler to window's throttledresize event that, when triggered, |
21 |
| - passes a reference of itself that is accessible by the callback function. |
22 |
| - */ |
23 |
| - $(window).on( 'throttledresize', throttledresizeHandler ); |
| 15 | + <pre><code><![CDATA[ |
| 16 | +var count = 0; |
| 17 | +$(function() { |
| 18 | + // Bind an event handler to window throttledresize event that, when triggered, |
| 19 | + // passes a reference of itself that is accessible by the callback function. |
| 20 | + $( window ).on( "throttledresize", throttledresizeHandler ); |
24 | 21 |
|
25 |
| - function throttledresizeHandler( event ) { |
26 |
| - $( "#output-text" ).html( 'Event Count: ' + ++count ); |
27 |
| - } |
| 22 | + function throttledresizeHandler( event ) { |
| 23 | + $( "#output-text" ).html( "Event Count: " + ++count ); |
| 24 | + } |
28 | 25 |
|
29 |
| - // You can also manually force this event to fire. |
30 |
| - $(window).trigger( "throttledresize" ); |
31 |
| - }); |
32 |
| - ]]></code> |
33 |
| - </pre> |
| 26 | + // You can also manually force this event to fire. |
| 27 | + $( window ).trigger( "throttledresize" ); |
| 28 | +}); |
| 29 | +]]></code></pre> |
34 | 30 | <p>Visit this from your orientation-enabled device to see it in action!
|
35 | 31 | <iframe id="throttledresizeIframe" src="/resources/throttledresize/example1.html" style="width:100%;height:90px;border:0px"></iframe></p>
|
36 | 32 |
|
|
0 commit comments