-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy paththrottledresize.xml
41 lines (37 loc) · 2.03 KB
/
throttledresize.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?xml version="1.0"?>
<entry name="throttledresize" type="event" return="jQuery">
<title>throttledresize</title>
<desc>Limits the rate of the execution of handlers on resize events.</desc>
<longdesc>
<p>The jQuery Mobile <code>throttledresize</code> event is a special event that prevents browsers from running continuous callbacks on resize. <code>throttledresize</code> is used internally for orientationchange in browsers like Internet Explorer. <code>throttledresize</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>
<p>The <code>throttledresize</code> event is triggered if orientationchange is not natively supported.</p>
<p>This event triggers when the browser window resizes from:</p>
<ol>
<li>an orientation change (orientation-enabled device);</li>
<li>changes in dimension ratio that replicates a landspace/portrait change (resizing a desktop browser).</li>
</ol>
<xi:include href="../includes/core-extension-desc.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<pre><code><![CDATA[
var count = 0;
$(function() {
// Bind an event handler to window throttledresize event that, when triggered,
// passes a reference of itself that is accessible by the callback function.
$( window ).on( "throttledresize", throttledresizeHandler );
function throttledresizeHandler( event ) {
$( "#output-text" ).html( "Event Count: " + ++count );
}
// You can also manually force this event to fire.
$( window ).trigger( "throttledresize" );
});
]]></code></pre>
<p>Visit this from your orientation-enabled device to see it in action!
<iframe id="throttledresizeIframe" src="/resources/throttledresize/example1.html" style="width:100%;height:90px;border:0px"></iframe></p>
</longdesc>
<added>1.0</added>
<signature>
<argument name="callback" type="Function" optional="true">
<desc>A function to invoke after the the throttledresize event fires.</desc>
</argument>
</signature>
<category slug="events"/>
</entry>