Use jquery Mobile to build a simple mobile page

Source: Internet
Author: User

1. Add HTML page.

2. Declare html5document.

3. Load the jquery mobile Css, jquery and jquery Mobile link library.

4. Use the HTML standards defined by jquery Mobile, write Web page schemas, and content.

To add jquery Mobile to your Web page, add the following method:

Refer to jquery Mobile from CDN (recommended)

<Linkrel= "stylesheet"href= "Http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">    <Scriptsrc= "Http://code.jquery.com/jquery-1.8.3.min.js"></Script>    <Scriptsrc= "Http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></Script>

Download jquery Mobile Library from jquerymobile.com

Download the file from jquerymobile.com .

  <  link  rel  =stylesheet  href  =jquery.mobile-1.3.2.css   >  <  script  src  =jquery.js  ></ script   >  <  script  src  =jquery.mobile-1.3.2.js  ></ script  >  
    • data-role= "Page" is the screen that is displayed in the browser
    • Data-role= "Header" To create a toolbar above the page (often used for headings and search buttons)
    • data-role= "Content" defines the contents of a page, such as text, images, forms, and buttons, etc.
    • data-role= "Footer" To create a toolbar at the bottom of the page

When writing a mobile web site, be sure to write a meta name for the viewport attribute, because this property represents the adaptive Web page. The simple notation is:<meta name="viewport" content="Width=device-width, Initial-scale=1 "> represents the width of the website as the driving device.

    • Width: Control widths, you can specify a width value, or enter Device-width, which indicates that the width is automatically adjusted as the device width
    • Height: Control altitude, or enter Device-height.
    • Initial-scale: initial scale, minimum 0.25, maximum of 0.5.
    • Minimum-scale: The minimum scale that allows the user to scale, with a minimum of 0.25 and a maximum of 0.5.
    • Maximum-scale: The maximum scale that allows the user to scale, with a minimum of 0.25 and a maximum of 0.5.
    • User-scalable: Whether the user is allowed to scale manually, you can enter 0 or 1, or you can enter Yes or No.

code example:

<!DOCTYPE HTML><HTML><Head>    <MetaCharSet= "UTF-8">    <Metaname= "Viewport"content= "Width=device-width, initial-scale=1"><!--Adaptive page -    <Linkrel= "stylesheet"href= "Http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">    <Scriptsrc= "Http://code.jquery.com/jquery-1.8.3.min.js"></Script>    <Scriptsrc= "Http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></Script></Head><Body><DivData-role= "page" >    <DivData-role= "header">        <H1>My Site</H1>    </Div>    <DivData-role= "Content">        <P>This is the body part.</P>        <ulData-role= "ListView">            <LiData-role= "List-divider">My goal</Li>            <Li><ahref= "Http://www.baidu.com">Exciting content is about to be presented</a></Li>            <Li><ahref= "Http://www.baidu.com">Baidu a bit, you know</a></Li>            <Li><ahref= "Http://www.baidu.com">Persist to succeed</a></Li>        </ul>    </Div>    <DivData-role= "Footer">        <H1>This is the footer text</H1>    </Div></Div></Body></HTML>

Results page:

Use jquery Mobile to build a simple mobile page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.