Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Mobile Pages

jQuery Mobile Pages


Getting started with jQuery Mobile

| lamp | Although jQuery Mobile is compatible with all mobile devices, it is not fully compatible with PCs (due to limited CSS3 support).

 为了更好的阅读本教程,建议您使用 Google Chrome 浏览器。 |

| --- | --- |

Example

data-role="page"

 

data-role="header"

   

Welcome to my homepage

 

 

data-role="main" class="ui-content"

   

I am a mobile developer now!!

 

 

data-role="footer"

   

Footer text

 

Try it »

Example analysis:

lamp jQuery Mobile relies on HTML5 data-* attributes to support various UI elements, transitions, and page structures. Browsers that do not support them will silently discard them.

Adding jQuery Mobile to a page

Using jQuery Mobile, you can create multiple different pages in a single HTML file.

You can use different href attributes to distinguish pages that use the same unique id:

Example

id="pageone"

 

   

href="#pagetwo"

Jump to the second page

 

id="pagetwo"

 

   

href="#pageone"

Jump to the first page

 

Try it »

Note: When a web application has a large amount of content (text, images, scripts, etc.) it will seriously affect the loading time. If you don't want to use internal page links you can use external files:



访问外部文件


Using a page as a dialog

A dialog is used to display page information or to input form information.

Adding data-rel="dialog" to a link makes a dialog pop up when the user clicks the link:

Example

data-dialog="true"

id="pagetwo">

 

Try it »