You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/about/getting-started.html
+47-57Lines changed: 47 additions & 57 deletions
Original file line number
Diff line number
Diff line change
@@ -31,44 +31,44 @@ <h2>Getting Started with jQuery Mobile</h2>
31
31
<p>jQuery Mobile provides a set of touch-friendly UI widgets and an AJAX-powered navigation system to support animated page transitions. Building your first jQuery Mobile page is easy, here's how:</p>
32
32
33
33
<h2>Create a basic page template</h2>
34
-
<p>Pop open your favorite text editor and paste in the <ahref="../pages/page-anatomy.html" id="" title="page-anatomy">page template</a> below. In the <code>head</code>, a meta <code>viewport</code> tag and references to jQuery, jQuery Mobile and the mobile theme stylesheet from the CDN are all you need to get started. In the <code>body</code>, add a div with a <code>data-role</code> of <code>page</code> to hold your page contents.</p>
34
+
<p>Pop open your favorite text editor, paste in the <ahref="../pages/page-anatomy.html" id="" title="page-anatomy">page template</a> below, save and open in a browser. You are now a mobile developer!</p>
35
+
<p>Here's what's in the template. In the <code>head</code>, a meta <code>viewport</code> tag sets the screen width to the pixel width of the device and references to jQuery, jQuery Mobile and the mobile theme stylesheet from the CDN add all the styles and scripts. </p>
36
+
<p>In the <code>body</code>, a div with a <code>data-role</code> of <code>page</code> is the wrapper used to delineate a page, and the header bar (<code>data-role="header"</code>) and content region (<code>data-role="content"</code>) are added inside to create a basic page (these are both optional). These <code>data-</code> attributes are HTML5 attributes are used throughout jQuery Mobile to transform basic markup into an enhanced and styled widget.</p>
<p>All the normal <ahref="../content/content-html.html">HTML elements</a> and styles work as you'd expect - headings, lists, paragraphs. Write your own custom styles to create custom layouts or designs by adding a custom stylesheet to the head and just go to town. There is no required markup in your page. In fact, even the page wrapper is optional.</p>
59
-
60
-
<h2>Make a button</h2>
61
-
<p>There are a few ways to make <ahref="../buttons/buttons-types.html" title="buttons-types">buttons</a>, but lets turn a link into a button so it's easy to click. Just start with a link and add a <code>data-role="button"</code> attribute to it. These special HTML5 <code>data-</code> attributes are used throughout jQuery Mobile to transform basic markup into a widget. You can add an <ahref="../buttons/buttons-icons.html">icon</a> with the <code>data-icon</code> attribute and optionally set its position with the <code>data-iconpos</code> attribute.</p>
<p>Inside your content container, you can add all any standard <ahref="../content/content-html.html">HTML elements</a> - headings, lists, paragraphs, etc. You can write your own custom styles to create custom layouts by adding an additional stylesheet to the <code>head</code> after the jQuery Mobile stylesheet.</p>
69
69
70
70
<h2>Make a listview</h2>
71
-
<p>jQuery Mobile includes a diverse set of common <ahref="../lists/docs-lists.html" id="" title="docs-lists">listviews</a> that are basically built from lists with a <code>data-role="listview"</code>. Here is a simple linked list that has a role of <code>listview</code>. We're going to make this look like an inset module by adding a <code>data-inset="true"</code> and add a dynamic search filter with, you guessed it, <code>data-filter="true"</code>.</p>
71
+
<p>jQuery Mobile includes a diverse set of common <ahref="../lists/docs-lists.html" id="" title="docs-lists">listviews</a> that are coded as lists with a <code>data-role="listview"</code> added. Here is a simple linked list that has a role of <code>listview</code>. We're going to make this look like an inset module by adding a <code>data-inset="true"</code> and add a dynamic search filter with the <code>data-filter="true"</code> attributes.</p>
<p>It's easy to make a <ahref="../content/content-collapsible.html" id="" title="content-collapsible">collapsible block</a> that can be toggled open and close to show or hide its content. Simply add the <code>data-role="collapsible"</code> attribute to a div container followed by a header element (H1-H6) and any HTML-Markup. jQuery Mobile will wrap your markup into a container, that is collapsed by default and hidden/shown when its header is clicked. Optionally you can set the content-background and border with the <code>data-content-theme</code> attribute like shown below.</p>
<p>Add a header <ahref="../toolbars/docs-bars.html" id="" title="docs-bars">toolbar</a> by adding a div. Set the <code>data-role</code> to <code>header</code> and add a heading tag inside (any heading from H1-H6 can be used).</p>
<p>There are a few ways to make <ahref="../buttons/buttons-types.html" title="buttons-types">buttons</a>, but lets turn a link into a button so it's easy to click. Just start with a link and add a <code>data-role="button"</code> attribute to it. You can add an <ahref="../buttons/buttons-icons.html">icon</a> with the <code>data-icon</code> attribute and optionally set its position with the <code>data-iconpos</code> attribute.</p>
<p>jQuery Mobile has a robust <ahref="../api/themes.html" id="">theme framework</a> that supports up to 26 sets of toolbar, content and button colors, called a "swatch". Just add a <code>data-theme="e"</code> attribute to any of the widgets on this page: page, header, list, input for the slider, or button to turn it yellow. Try different swatch letters in default theme from a-e to mix and match swatches. </p>
124
+
<p>Cool party trick: add the theme swatch to the page and see how all the widgets inside the content will automatically inherit the theme (headers don't inherit, they default to swatch A).</p>
134
125
135
-
<h2>Tweak the theme</h2>
136
-
<p>Don't like black? Fine. jQuery Mobile has a robust <ahref="../api/themes.html" id="">theme framework</a> that supports up to 26 sets of toolbar, content and button colors, called a "swatch". Just add a <code>data-theme="e"</code> attribute to the header div to turn it yellow. Try different swatch letters in default theme from a-e.</p>
<p>Extra credit: try adding a <code>data-theme</code> to any of the other widgets on this page: page wrapper, buttons, lists, even the input for the slider - same deal. </p>
<p>When you're ready to build a custom theme, use <ahref="http://www.jquerymobile.com/themeroller" rel="external">ThemeRoller</a> to drag and drop, then download a custom theme.</p>
0 commit comments