|
1 | 1 | <?xml version="1.0"?>
|
2 |
| -<entry name="orientationchange" type="event" return="jQuery"> |
3 |
| - <title>orientationchange</title> |
| 2 | +<entry name="orientationchange" type="event" example-selector="window"> |
| 3 | + <title>orientationchange event</title> |
4 | 4 | <desc>Device portrait/landscape orientation event</desc>
|
5 | 5 | <longdesc>
|
6 |
| - <p>The jQuery Mobile <code>orientationchange</code> event triggers when a device orientation changes, either by turning the device vertically or horizontally. When bound to this event the callback function has the event object. The event object contains an <code>orientation</code> property equal to either "portrait" or "landscape".</p> |
7 |
| - <p>Note that we bind to the browser's resize event when <code>orientationchange</code> is not natively supported or if <code>$.mobile.orientationChangeEnabled</code> is set to false.</p> |
8 |
| - |
9 |
| - <div style="padding: 0.4em 15px; background: #FFF3A5; "> |
10 |
| - <h3>orientationchange timing</h3> |
| 6 | + <p>The jQuery Mobile <code>orientationchange</code> event triggers when a device orientation changes, either by turning the device vertically or horizontally. When bound to this event the callback function has the event object. The event object contains an <code>orientation</code> property equal to either <code>"portrait"</code> or <code>"landscape"</code>.</p> |
| 7 | + <p>Note that we bind to the browser's resize event when <code>orientationchange</code> is not natively supported or if <code>$.mobile.orientationChangeEnabled</code> is set to <code>false</code>.</p> |
11 | 8 |
|
12 |
| - <p>The timing of the <code>orientationchange</code> with relation to the change of the client height and width is different between browsers, though the current implementation will give you the correct value for <code>event.orientation</code> derived from <code>window.orientation</code>. This means that if your bindings are dependent on the height and width values you may want to disable <code>orientationChange</code> altogether with <code>$.mobile.orientationChangeEnabled = false</code> to let the fallback resize code trigger your bindings.</p></div> |
13 |
| - <p></p> |
14 |
| - <xi:include href="../includes/core-extension-desc.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/> |
15 |
| - <pre> |
16 |
| - <code><![CDATA[ |
17 |
| - $(function() { |
18 |
| - /* |
19 |
| - Bind an event to window.orientationchange that, when the device is turned, |
20 |
| - gets the orientation and displays it to on screen. |
21 |
| - */ |
22 |
| - $(window).on( 'orientationchange', orientationChangeHandler ); |
| 9 | + <div style="padding: 0.5em 1em; margin: 1em; background: #FFF3A5;"> |
| 10 | + <h3>orientationchange timing</h3> |
23 | 11 |
|
24 |
| - function orientationChangeHandler( event ) { |
25 |
| - $( "h1#orientation" ).html( "This device is in " + event.orientation + " mode!" ); |
26 |
| - } |
27 |
| - // You can also manually force this event to fire. |
28 |
| - $(window).orientationchange(); |
29 |
| - }); |
30 |
| - ]]></code> |
31 |
| - </pre> |
32 |
| - <p>Visit this from your orientation-enabled device to see it in action! |
33 |
| - <iframe id="orientationIframe" src="/resources/orientationchange/example1.html" style="width:100%;height:90px;border:0px"></iframe> |
34 |
| - </p> |
| 12 | + <p>The timing of the <code>orientationchange</code> event with relation to the change of the client height and width is different between browsers, though the current implementation will give you the correct value for <code>event.orientation</code> derived from <code>window.orientation</code>. This means that if your bindings are dependent on the height and width values you may want to disable <code>orientationChange</code> altogether with <code>$.mobile.orientationChangeEnabled = false</code> to let the fallback resize code trigger your bindings.</p> |
| 13 | + </div> |
35 | 14 | </longdesc>
|
36 | 15 | <added>1.0</added>
|
37 | 16 | <signature>
|
38 |
| - <argument name="callback" type="Function" optional="true"> |
39 |
| - <desc>A function to invoke after the the orientationchange event fires.</desc> |
40 |
| - </argument> |
| 17 | + <property name="orientation" type="String"> |
| 18 | + <desc>The new orientation of the device. Possible values are <code>"portrait"</code> and <code>"landscape"</code>.</desc> |
| 19 | + </property> |
41 | 20 | </signature>
|
| 21 | + <example> |
| 22 | + <height>90</height> |
| 23 | + <desc>Visit this from your orientation-enabled device to see it in action!</desc> |
| 24 | + <code><![CDATA[ |
| 25 | +// Bind an event to window.orientationchange that, when the device is turned, |
| 26 | +// gets the orientation and displays it to on screen. |
| 27 | +$( window ).on( "orientationchange", function( event ) { |
| 28 | + $( "#orientation" ).text( "This device is in " + event.orientation + " mode!" ); |
| 29 | +}); |
| 30 | +
|
| 31 | +// You can also manually force this event to fire. |
| 32 | +$( window ).orientationchange(); |
| 33 | +]]></code> |
| 34 | + <html><![CDATA[ |
| 35 | +<h1 id="orientation">orientationchange Not Supported on this Device.</h1> |
| 36 | +]]></html> |
| 37 | + </example> |
42 | 38 | <category slug="events"/>
|
43 | 39 | </entry>
|
0 commit comments