博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jQuery Mobile开发1-基本框架
阅读量:6950 次
发布时间:2019-06-27

本文共 4395 字,大约阅读时间需要 14 分钟。

HTML 页眉部分加载三个重要的 jQuery Mobile 组件:

  • jQuery Core 库 — 核心 jQuery 库
  • jQuery Mobile 库 — jQuery 框架特定于移动的部分
  • jQuery Mobile CSS — 定义核心 jQuery Mobile UI 元素的 CSS,它定义过渡和不同的 UI 小部件,比如滑块和按钮,大量使用 Webkit 变形和动画。
  • jQuery Mobile theme CSS — 可选项

$.mobile and supported methods and events

 jQuery Mobile新增加的tag属性

Component HTML5 data-* attribute
Header, Footer toolbars <div data-role="header">
<div data-role="footer">
Content body <div data-role="content">
Buttons <a href="index.html" data-role="button"
data-icon="info">Button</a>
Grouped buttons <div data-role="controlgroup">
<a href="index.html" data-role="button">Yes</a>
<a href="index.html" data-role="button">No</a>
<a href="index.html" data-role="button">Hell Yeah</a>
</div>
Inline buttons <div data-inline="true">
<a href="index.html" data-role="button">Foo</a>
<a href="index.html" data-role="button" data-theme="b">Bar</a>
</div>
Form element (Select menu) <div data-role="fieldcontain">
<label for="select-options" class="select">Choose an option:</label>
<select name="select-options" id="select-options">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option2">Option 3</option>
</select>
</div>
Basic List views <ul data-role="listview">
<li><a href="index.html">One</a></li>
<li><a href="index.html">Two</a></li>
<li><a href="index.html">Three</a></li>
</ul>
Dialogs <a href="foo.html" data-rel="dialog">Open dialog</a>
<a href="dialog.html" data-role="button" data-inline="true"
data-rel="dialog" data-transition="pop">Open dialog</a>
Transitions <a href="index.html" data-transition="pop" data-back="true">

 

一、jQuery Mobile开发mobile web page Structure

单页面框架

jQuery Mobile web template

Page Title

Page content goes here.

Page Footer

其中:

1.<meta name="viewport" content="width=device-width, initial-scale=1">

用于自适应页面,即responsive web design

2. data-role

是jQuery Mobile的特征tag ,这里 data-role="page" 表示本网页是页面属性

二、多页面框架——多个本地页面

 

     
Multi-page template

Multi-page

One

I have an id of "one" on my page container. I'm first in the source order so I'm shown when the page loads.

You link to internal pages by referring to the id of the page you want to show. For example, to link to the page with an id of "two", my link would have a href="#two" in the code.

Show internal pages:

Show page "two"

Show page "popup" (as a dialog)

Page Footer

Two

Two

I have an id of "two" on my page container. I'm the second page container in this multi-page template.

Notice that the theme is different for this page because we've added a few data-theme swatch assigments here to show off how flexible it is. You can add any content or widget to these pages, but we're keeping these simple.

Back to page "one"

Page Footer

 

三、页面主题——theme

在data-theme 中定义,如
定义了inner page是用的主题a 默认主题如下图

其他主题如下图

四、页面过渡

jQuery Mobile 支持基于 CSS 的页面过渡(受到 jQtouch 的启发),页面过渡在导航到一个新页面和返回上一个页面时应用。这些过渡包括:

幻灯片——
提供一个水平过渡
向上滑动和向下滑动——
提供上下屏幕的过渡
弹出——
提供一个爆炸式过渡类型
淡出——
提供一个淡出过渡
翻页——
提供一个翻页过渡

可以以两种方式添加页面过渡:

  • 向链接添加一个数据过渡属性,使用 <a href="index.html" data-transition="pop" data-back="true">

    在静态页面上使用 data-transition

  • 通过编程方式,使用 $.mobile.changePage("pendingtasks.html", "slideup");

    处理动态页面时使用编程方法。

 

转载于:https://www.cnblogs.com/JoannaQ/archive/2012/08/26/2657208.html

你可能感兴趣的文章
ajax模式 同步和异步
查看>>
我喜欢的vs code快捷键for mac
查看>>
sql表的复制问题
查看>>
es6的新内容
查看>>
Java教程
查看>>
跟着大神学zookeeper分布式锁实现-----来自Ruthless
查看>>
vue2.0 兼容ie9及其以上
查看>>
Xml中SelectSingleNode方法,xpath查找某节点用法
查看>>
JAVA - JAVA编译运行过程
查看>>
计时器setInterval
查看>>
iOS开发个人开发账号的证书详细使用及介绍
查看>>
尺取法
查看>>
Your APP_BUILD_SCRIPT points to an unknown file: ./jni/Android.mk
查看>>
NOIP-珠心算
查看>>
使用crypt配置Basic Auth登录认证
查看>>
sklearn
查看>>
linux命令系列目录
查看>>
sql server 2008学习1–系统数据库
查看>>
sql server08 查询优化系列 3-2 sql 查询性能分析
查看>>
JS 变量
查看>>