美文网首页
初识jQuery Mobile

初识jQuery Mobile

作者: 蝴蝶结199007 | 来源:发表于2017-06-19 11:51 被阅读13次

jQuery Mobile 是创建移动 web 应用程序的框架。
jQuery Mobile 适用于所有流行的智能手机和平板电脑。
jQuery Mobile 使用 HTML5 和 CSS3 通过尽可能少的脚本对页面进行布局。

尽管 jQuery Mobile 适用于所有移动设备,它在台式计算机上仍然可能存在兼容性问题(由于有限的 CSS3 支持)。
HTML5 data- 属性用于通过 jQuery Mobile 为移动设备创建“对触控友好的”交互外观。*

<body>
<div data-role="page">
  <div data-role="header">
    <h1>欢迎访问我的主页</h1>
  </div>
  <div data-role="content">
    <p>我是一名移动开发者!</p>
  </div>
  <div data-role="footer">
    <h1>页脚文本</h1>
  </div>
</div>
</body>
  • data-role="page" 是显示在浏览器中的页面
  • data-role="header" 创建页面上方的工具栏(常用于标题和搜索按钮)
  • data-role="content" 定义页面的内容,比如文本、图像、表单和按钮,等等
  • data-role="footer" 创建页面底部的工具栏

在 jQuery Mobile 中添加页面
在单一 HTML 文件中创建多个页面,通过唯一的 id 来分隔每张页面,并使用 href 属性来连接彼此。

<div data-role="page" id="pageone">
  <div data-role="content">
    <a href="#pagetwo">转到页面二</a>
  </div>
</div>

<div data-role="page" id="pagetwo">
  <div data-role="content">
    <a href="#pageone">转到页面一</a>
  </div>
</div>

将页面用作对话框
对话框是用来显示信息或请求输入的视窗类型。
如需在用户点击(轻触)链接时创建一个对话框,请向该链接添加 data-rel="dialog"

<div data-role="page" id="pageone">
  <div data-role="content">
    <a href="#pagetwo" data-rel="dialog">转到页面二</a>
  </div>
</div>

<div data-role="page" id="pagetwo">
  <div data-role="content">
    <a href="#pageone">转到页面一</a>
  </div>
</div>

相关文章

网友评论

      本文标题:初识jQuery Mobile

      本文链接:https://www.haomeiwen.com/subject/nwsgqxtx.html