初识jQuery Mobile

2017-06-19  本文已影响13人  蝴蝶结199007

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>

在 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>
上一篇 下一篇

猜你喜欢

热点阅读