jquery mobile使用和感受
认识jquery
jQuery Mobile就是一个基于jquery+jqueryui的插件,是一个统一的,在的基础上能够快速建立一个轻便的智能手机和平板的框架。
官方网站在这里:http://jquerymobile.com
jquerymobile继承了jquery的口号:wirte less do more,全面兼容各种平台的手机。对于不支持的手机,同样也会显示最基本的样式。
我们在Twitter上遇到过:”WEB设计和jquery mobile应该用哪一个呢?“这个问题好几次了。我们的回答很简单的”全用“。
jquery mobile框架可以视为一组对触摸友好的UI组件,用来适应你响应式的WEB设计。即使是在1.0版本中,我们的demos & docs站都是用media queries来做响应式体验的,但是我们认为可以做更多的工
作来帮助人们在他们自己的项目中使用响应式的WEB设计。
jquery mobile作为一个框架,确实是挺方便的,而且都是通过data-** 来使用的,注意,必须是使用html5格式才有效。
jquery mobile的完整写法
下面举一个常见的jquery mobile开发页面。
<div data-role=”page” data-theme=”c”>
<div data-role=”header” data-theme=”d”>
<h1></h1><a href=”” data-rle=”back” data-icon=”back” data-iconpos=”left”>返回</a><a href=”#” data-icon=”gear” data-iconpos=”left” class=”ui-btn-right”>设置</a>
<div data-role=”navbar”>
<ul><li><a href=””>网站首页</a></li><li><a href=””>主题下载</a></li><li><a href=””>博客教程</a></li></ul>
</div>
</div>
<div data-role=”content”>
<h2>jquery mobile 教程</h2>
<p>jquery mobile 博客</p>
</div>
<div data-role=”footer”>
<h4>wordpress主题吧版权所有</h4>
</div>
</div>
jquery mobile的扩展
看到了吗?这就是一个完整的页面,当然你还可以在一个页面里面再增加一个page,然后通过给page设定一个id,通过#id来访问,如果不是在同一个页面,则需要通过锚点来访问,注意要设置连接为data-ajax=”false” .
jquery mobile里面有很多小工具。下面举几个常用的小工具
1.listview.
这玩意就相当于我们的ol和ul的样式了。
<ul data-role=”listview” data-inset=”true” data-theme=”d” data-divider-theme=”d”>
<li data-role=”list-divider”>Mail</li>
<li><a href=”#”>Inbox</a></li>
<li><a href=”#”>Outbox</a></li>
<li data-role=”list-divider”>Contacts</li>
<li><a href=”#”>Friends</a></li>
<li><a href=”#”>Work</a></li>
</ul>
更多使用请参考:
2.form elements
表单元素,是做网页比较常见的,也是很头痛的。
<label for=”text-basic”>Text input:</label>
<input name=”text-basic” id=”text-basic” value=”” type=”text”>
<fieldset data-role=”controlgroup”>
<legend>Checkboxes, vertical controlgroup:</legend>
<input name=”checkbox-1a” id=”checkbox-1a” checked=”” type=”checkbox”>
<label for=”checkbox-1a”>Cheetos</label>
<input name=”checkbox-2a” id=”checkbox-2a” type=”checkbox”>
<label for=”checkbox-2a”>Doritos</label>
<input name=”checkbox-3a” id=”checkbox-3a” type=”checkbox”>
<label for=”checkbox-3a”>Fritos</label>
<input name=”checkbox-4a” id=”checkbox-4a” type=”checkbox”>
<label for=”checkbox-4a”>Sun Chips</label>
</fieldset>
<fieldset data-role=”controlgroup”>
<legend>Radio buttons, vertical controlgroup:</legend>
<input name=”radio-choice-1″ id=”radio-choice-1″ value=”choice-1″ checked=”checked” type=”radio”>
<label for=”radio-choice-1″>Cat</label>
<input name=”radio-choice-1″ id=”radio-choice-2″ value=”choice-2″ type=”radio”>
<label for=”radio-choice-2″>Dog</label>
<input name=”radio-choice-1″ id=”radio-choice-3″ value=”choice-3″ type=”radio”>
<label for=”radio-choice-3″>Hamster</label>
<input name=”radio-choice-1″ id=”radio-choice-4″ value=”choice-4″ type=”radio”>
<label for=”radio-choice-4″>Lizard</label>
</fieldset>
jquery mobile的资源站
- JQM 案例展示:
其中例子不断在更新中…有些站点需要翻墙才能打开.. - JQM 滚动条插件iScroll-4
Site:
Demo: - JQM 弹出插件
Site: - 开源移动设备检测脚本
Site: - JQM日期插件
Site: (推荐)
Site:
Site: (类似) - jqmobile web 程序展示,单击图片,然后点右下角的链接。
- 小插件,手机,pad上的布局
- 一个例子,包括播放MP3,文档下载。
- JQM google地图应用
- 图片/div滑动
- 图片切换photoswipe
Site:
demo:
描述:在手机上操作很流畅,能自使用屏幕尺寸,竖屏显示效果很好,横屏图片太大了,也就是列数固定的原因。 - 图片遮罩类似lightbox: Touch-Gallery
Site:
描述:一个图片箱子插件,点击图片放大,周围变黑遮罩,双击周围返回列表。 - Mobile实现驾驶导航
网址:
demo: - Mobile Photo Album
网址:
demo: - 更多插件资源
30+最好的JQuery画廊插件:
240个Jquery 插件:
Jquery 官方插件:
jqueryMobile 插件和 Demo:
常见问题解答:
- jQM如何固定header和footer,只滚动content部分?
(推荐) - JQM基础–用户登录,注册
- JQM 页面传参
您可能感兴趣的文章:
jQuery Mobile 简介
jquery mobile使用和感受
php有几种编码
jQuery Mobile 安装
jQuery Mobile页面事件
jQuery Mobile 教程
10个优秀的jQuery Mobile主题
H5开发app用什么框架
jQuery Mobile 事件
jquery验证手机号码、邮箱格式是否正确示例代码