Skip to content

Commit 499bcb6

Browse files
author
scottjehl
committed
added methods documentation
1 parent 1730446 commit 499bcb6

File tree

3 files changed

+145
-0
lines changed

3 files changed

+145
-0
lines changed

docs/api/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ <h1>API</h1>
2020
<li data-role="list-divider">API</li>
2121
<li><a href="globalconfig.html">Configuring defaults</a></li>
2222
<li><a href="events.html">Events: touch, page, animation</a></li>
23+
<li><a href="methods.html">Methods: Change pages, Loading messages, etc</a></li>
2324
<li><a href="mediahelpers.html">Orientation &amp; resolution targeting</a></li>
2425
<li><a href="themes.html">Theme framework</a></li>
2526
</ul>

docs/api/methods.html

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>jQuery Mobile Docs - Methods</title>
6+
<link rel="stylesheet" href="../../themes/default" />
7+
<link rel="stylesheet" href="../_assets/css/jqm-docs.css"/>
8+
<script type="text/javascript" src="../../js/"></script>
9+
</head>
10+
<body>
11+
12+
<div data-role="page">
13+
14+
<div data-role="header">
15+
<h1>Methods</h1>
16+
</div><!-- /header -->
17+
18+
<div data-role="content">
19+
20+
21+
<p>jQuery Mobile exposes several methods and properties on the $.mobile object for use in your applications.</p>
22+
23+
24+
<dl>
25+
<dt><code>$.mobile.changePage</code> (<em>method</em>)</dt>
26+
<dd>Programmatically change from one page to another. This method is used internally for transitions that occur as a result of clicking a link or submitting a form, when those features are enabled.</dd>
27+
28+
<dd>
29+
30+
<dl>
31+
<dt>Arguments</dt>
32+
<dd><code>to</code>
33+
<ul>
34+
<li>String, url to transition to (<code>"about/us.html"</code>)</li>
35+
<li>jQuery object (<code>$("#about")</code>)</li>
36+
<li>Array specifying two page references [from,to] for transitioning from a known page. From is otherwise assumed to be the current page in view (or $.mobile.activePage ).</li>
37+
<li>Object for sending form data. (<code>{to: url, data: serialized form data, type: "get" or "post"}</code></li>
38+
</dd>
39+
40+
<dd><code>transition</code> (<em>string</em>, examples: "pop", "slide"," "none")</dd>
41+
<dd><code>back</code> (<em>boolean</em>, default: false). True will cause a reverse-direction transition.</dd>
42+
<dd><code>changeHash</code> (<em>boolean</em>, default: true). Update the hash to the to page's URL when page change is complete.</dd>
43+
</dl>
44+
</dd>
45+
46+
<dd>Examples:
47+
<pre>
48+
<code>
49+
<strong>//transition to the "about us" page with a slideup transition, where</strong>
50+
$.mobile.changePage("about/us.html", "slideup");
51+
52+
<strong>//transition to the "search results" page, using data from a form with an ID of "search"" </strong>
53+
$.mobile.changePage({
54+
url: "searchresults.php",
55+
type: "get",
56+
data: $("form#search").serialize()
57+
});
58+
59+
<strong>//transition to the "confirm" page with a "pop" transition without tracking it in history </strong>
60+
$.mobile.changePage("../alerts/confirm.html", "pop", false, false);
61+
62+
</code>
63+
</pre>
64+
65+
</dd>
66+
67+
<dt><code>$.mobile.pageLoading</code> (<em>method</em>)</dt>
68+
<dd>Show or hide the page loading message, which is configurable via $.mobile.loadingMessage.</dd>
69+
<dd>
70+
<dl>
71+
<dt>Arguments:</dt>
72+
<dd><code>Done</code> (<em>boolean</em>, defaults to false, meaning loading has started). True will hide the loading message.</dd>
73+
</dl>
74+
</dd>
75+
76+
<dd>Examples:
77+
<pre>
78+
<code>
79+
<strong>//cue the page loader</strong>
80+
$.mobile.pageLoading();
81+
82+
<strong>//hide the page loader</strong>
83+
$.mobile.pageLoading( true );
84+
</code>
85+
</pre>
86+
87+
</dd>
88+
89+
90+
<dt><code>$.mobile.silentScroll</code> (<em>method</em>)</dt>
91+
<dd>Scroll to a particular Y position without triggering scroll event listeners.</dd>
92+
<dd>
93+
<dl>
94+
<dt>Arguments:</dt>
95+
<dd><code>yPos</code> (<em>number</em>, defaults to 0). Pass any number to scroll to that Y location.</dd>
96+
</dl>
97+
</dd>
98+
99+
<dd>Examples:
100+
<pre>
101+
<code>
102+
<strong>//scroll to Y 100px</strong>
103+
$.mobile.silentScroll(100);
104+
</code>
105+
</pre>
106+
107+
</dd>
108+
109+
110+
<dt><code>$.mobile.addResolutionBreakpoints</code> (<em>method</em>)</dt>
111+
<dd>Add width breakpoints to the min/max width classes that are added to the HTML element.</dd>
112+
<dd>
113+
<dl>
114+
<dt>Arguments:</dt>
115+
<dd><code>values</code> (<em>number or array</em>). Pass any number or array of numbers to add to the resolution classes. Read more about this feature here: <a href="mediahelpers.html">Orientation &amp; resolution targeting</a>.</dd>
116+
</dl>
117+
</dd>
118+
119+
<dd>Examples:
120+
<pre>
121+
<code>
122+
<strong>//scroll to Y 100px</strong>
123+
$.mobile.silentScroll(100);
124+
</code>
125+
</pre>
126+
127+
</dd>
128+
129+
130+
131+
<dt><code>$.mobile.activePage</code> (<em>property</em>)</dt>
132+
<dd>Reference to the page currently in view.</dd>
133+
134+
135+
136+
137+
</dl>
138+
</div><!-- /content -->
139+
140+
</div><!-- /page -->
141+
142+
</body>
143+
</html>

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ <h1 id="jqm-logo"><img src="docs/_assets/images/jquery-logo.png" alt="jQuery Mob
3131
<li data-role="list-divider">API</li>
3232
<li><a href="docs/api/globalconfig.html">Configuring defaults</a></li>
3333
<li><a href="docs/api/events.html">Events: touch, page, animation</a></li>
34+
<li><a href="docs/api/methods.html">Methods: Change pages, Loading messages, etc</a></li>
3435
<li><a href="docs/api/mediahelpers.html">Orientation &amp; resolution targeting</a></li>
3536
<li><a href="docs/api/themes.html">Theme framework</a></li>
3637
</ul>

0 commit comments

Comments
 (0)