Page Title<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script><script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>今天介绍下它的Page:
页面间的跳转和切换,一般都是Page对象的切换,你可以在一个HTML页面中包含多个Page对象,切换通过 指定相应的Page ID就可以,如下面页面内容,默认显示第一个Page对象foo,在foo的Page Content中有个 bar链接,表示切换到bar Page,这样达到页面切换的效果,其实通过浏览器看其生成的内容可以知道,这都是通过CSS来达到效果的,最底层当然是display block/none什么的,只不过jQuery Mobile封装了很多CSS:.........
<!-- Start of first page -->默认在Page切换的时候,切换后的页面左上角默认包括一个Back的按钮回到上一个页面,页面URL中也体现出来,如../index.html#foo,表示index.html切换到id为foo的Page,或者index.html#docs-pages.html,表示从index.html切换到docs-pages.html,其实不管页面内链接还是页面间切换,jQuery Mobile都是发起Ajax请求加载新的页面。如果想链接到一个新界面,而且URL中不想有以前路径#新页面,可以通过在 加入链接属性rel="external"或data-ajax="false",这就告诉jQuery Mobile需要重新加载一个新的页面,而且URL也是全新的。<!-- /page --> <!-- Start of second page --><!-- /header -->Foo
<!-- /content -->I'm first in the source order so I'm shown as the page.
View internal page called bar
<!-- /header -->Page Footer
<!-- /page --><!-- /header -->Bar
<!-- /content -->I'm first in the source order so I'm shown as the page.
<!-- /header -->Page Footer