小强的HTML5移动开发之路(47)——jquerymobile基本的页面框架
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了小强的HTML5移动开发之路(47)——jquerymobile基本的页面框架,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3651字,纯文字阅读大概需要6分钟。
内容图文
![小强的HTML5移动开发之路(47)——jquerymobile基本的页面框架](/upload/InfoBanner/zyjiaocheng/389/80b3b4bd0bb140f6a001a0b8eade5a7e.jpg)
<!DOCTYPE html> <html> <head> <title>Jquery mobile 基本页面框架</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link href="css/jquery.mobile-1.3.2.min.css" rel="stylesheet" type="text/css"/> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery.mobile-1.3.2.min.js" type="text/javascript"></script> </head> <body> <p data-role="page"> <p data-role="header"> <h1>标题</h1> </p> <p data-role="content"> <p>内容部分</p> </p> <p data-role="footer"> <h4>页脚</h4> </p> </p> </body> </html>
说明:<meta name="viewport" content="width=device-width,initial-scale=1">设置浏览器的缩放宽度与等级,可以使页面的宽度与移动设备的屏幕宽度相同。
二、多容器页面结构
<!DOCTYPE html> <html> <head> <title>Jquery mobile 基本页面框架</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link href="css/jquery.mobile-1.3.2.min.css" rel="stylesheet" type="text/css"/> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery.mobile-1.3.2.min.js" type="text/javascript"></script> </head> <body> <p data-role="page" id="p1"> <p data-role="header"> <h1>标题</h1> </p> <p data-role="content"> <p>内容部分</p> <a href="#p2">下一页</a> </p> <p data-role="footer"> <h4>页脚</h4> </p> </p> <p data-role="page" id="p2" data-add-back-btn="true"> <p data-role="header"> <h1>标题</h1> </p> <p data-role="content"> <p>内容部分</p> </p> <p data-role="footer"> <h4>页脚</h4> </p> </p> </body> </html>
说明:data-add-back-btn属性表示是否在容器的左上角添加一个“回退”按钮,默认值为false.
另外给<a>元素添加data-rel属性也可以实现回退。
三、外部页面链接切换
<!DOCTYPE html> <html> <head> <title>Jquery mobile 基本页面框架</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link href="css/jquery.mobile-1.3.2.min.css" rel="stylesheet" type="text/css"/> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery.mobile-1.3.2.min.js" type="text/javascript"></script> </head> <body> <p data-role="page" id="p1"> <p data-role="header"> <h1>标题</h1> </p> <p data-role="content"> <p>内容部分</p> <a href="#p2">下一页</a> </p> <p data-role="footer"> <h4>页脚</h4> </p> </p> <p data-role="page" id="p2" data-add-back-btn="true"> <p data-role="header"> <h1>标题</h1> </p> <p data-role="content"> <em style="float:right;padding-right:5px"> <a href="about.htm">访问外部页面</a> </em> </p> <p data-role="footer"> <h4>页脚</h4> </p> </p> </body> </html>
<!DOCTYPE html> <html> <head> <title>Jquery mobile 基本页面框架</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link href="css/jquery.mobile-1.3.2.min.css" rel="stylesheet" type="text/css"/> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/jquery.mobile-1.3.2.min.js" type="text/javascript"></script> </head> <body> <p data-role="page" data-add-back-btn="true"> <p data-role="header"> <h1>外部页面</h1> </p> <p data-role="content"> 你好,感谢你的关注 </p> <p data-role="footer"> <h1></h1> </p> </p> </body> </html>
如果不想以ajax方式打开页面,在链接元素中添加rel="external"
四、预加载与页面缓存
<p data-role="content"> <em style="float:right;padding-right:5px"> <a href="about.htm" data-prefetch="true">访问外部页面</a> </em> </p>
使用页面缓存功能将会使DOM内容变大,一旦选择了缓存功能,要及时清理。
将page容器的data-dom-cache设置为true,可以将该页面的内容注入文档的缓存中,或者通过js代码设置一个全局的属性,代码如下:
$(function(){ $.mobile.page.prototype.options.domCache = true; })
以上就是小强的HTML5移动开发之路(47)——jquery mobile基本的页面框架的内容,更多相关内容请关注PHP中文网(www.gxlcms.com)!
内容总结
以上是互联网集市为您收集整理的小强的HTML5移动开发之路(47)——jquerymobile基本的页面框架全部内容,希望文章能够帮你解决小强的HTML5移动开发之路(47)——jquerymobile基本的页面框架所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。