程序猿都非常懒。你懂的!

生命的绝唱来机仅仅争朝夕,如诗的年华更需惜时如金。

不要让今天的懈怠成为一生的痛。

每天都在进步。

近期在学习jquery mobile开发。使用的button,绑定事件,和大家一起学习。一起分享!

直接上代码:

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
</head>
<body>
<div data-role="page" id="pageone">
<div data-role="header">
<h1>组合button</h1>
</div>
<div data-role="content">
<div data-role="controlgroup" data-type="horizontal">
<p>水平组合button:</p>
<a href="#" data-role="button" id="btn1">我绑定事件了</a>
<a href="#" data-role="button" id="btn2">方法2绑定事件</a>
<a href="#" data-role="button" id="btn3">button 3 blur</a>
</div><br>
<div data-role="controlgroup" data-type="vertical">
<p>垂直组合button (默认):</p>
<a href="#" data-role="button">button 1</a>
<a href="#" data-role="button">button 2</a>
<a href="#" data-role="button">button 3</a>
</div>
<p>内联button且不带圆角:</p>
<a href="#" data-role="button" data-inline="true">button 1</a>
<a href="#" data-role="button" data-inline="true">button 2</a>
<br>
<a href="#" data-role="button" data-inline="true" data-corners="false">button 1</a>
<a href="#" data-role="button" data-inline="true" data-corners="false">button 2</a>
<p>内联button:普通与迷你</p>
<a href="#" data-role="button" data-inline="true">button 1</a>
<a href="#" data-role="button" data-inline="true">button 2</a>
<br>
<a href="#" data-role="button" data-inline="true" data-mini="true">button 1</a>
<a href="#" data-role="button" data-inline="true" data-mini="true">button 2</a>
<div data-role="footer">
<h1>底部文本</h1>
</div>
</div>
<script type="text/javascript">
//先解绑,再绑定
$('#btn1').unbind().bind('click', function() {
alert('我绑定事件了');
});
//on直接绑定
$('#btn2').on('click', function() {
alert('on直接绑定事件了');
});
//on直接绑定失去焦点的事件
$('#btn3').on('blur', function() {
alert('on直接绑定失去焦点的事件了');
}); </script>
</body>
</html>

看看执行效果:

事件 描写叙述

hashchange 启用可标记 #hash 历史,哈希值会在一次独立的点击时发生时变化,比方一个用户点击后退button。会通过 hashchange事件进行处理。
navigate 包裹了 hashchange 和 popstate 的事件
orientationchange 方向改变事件,在用户垂直或者水平旋转移动设备时触发。
pagebeforechange 在页面切换之前,触发的事件。使用$.mobile.changePage()来切换页面,此方法触发2个事件,切换之前的pagebeforechange事件,和切换完毕后pagechange(成功)或者pagechangefailed(失败)。 pagebeforecreate 页面初始化时,初始化之前触发。
pagebeforehide 在页面切换后旧页面隐藏之前,触发的事件。
pagebeforeload 在载入请求发出之前触发
pagebeforeshow 在页面切换后显示之前,触发的事件。 pagechange 在页面切换成功后,触发的事件。使用$.mobile.changePage()来切换页面,此方法触发2个事件。切换之前的pagebeforechange事件,和切换完毕后pagechange(成功)或者pagechangefailed(失败)。
pagechangefailed 在页面切换失败时。触发的事件。使用$.mobile.changePage()来切换页面,此方法触发2个事件,切换之前的pagebeforechange事件,和切换完毕后pagechange(成功)或者pagechangefailed(失败)。
pagecreate 在页面创建成功之后。触发的事件,但增强完毕之前。 pagehide 在页面切换后老页面隐藏之后。触发的事件。
pageinit 在页面页面初始化时,触发的事件。 pageload 在页面全然载入成功后触发。
pageloadfailed 假设页面请求失败触发。
pageremove 在窗体视图从 DOM 中移除外部页面之前触发。 pageshow 在过渡动画完毕后,在"到达"页面触发。
scrollstart 当用户開始滚动页面时触发。 scrollstop 当用户停止滚动页面时触发。 swipe 当用户在元素上水平滑动时触发。
swipeleft 当用户从左划过元素超过 30px 时触发。
swiperight 当用户从右划过元素超过 30px 时触发。 tap 当用户敲击某元素时触发。
taphold 当元素敲击某元素并保持一秒时触发。
throttledresize 启用可标记 #hash 历史记录
updatelayout 由动态显示/隐藏内容的 jQuery Mobile 组件触发。 vclick 虚拟化的 click 事件处理器
vmousecancel 虚拟化的 mousecancel 事件处理器
vmousedown 虚拟化的 mousedown 事件处理器
vmousemove 虚拟化的 mousemove 事件处理器
vmouseout 虚拟化的 mouseout 事件处理器
vmouseover 虚拟化的 mouseover 事件处理器
vmouseup 虚拟化的 mouseup 事件处理器

点击下载学习资料:http://download.csdn.net/download/xmt1139057136/7422831

假设你还有不懂,请加qq群:135430763共同学习!

jQuery Mobile的学习时间bottonbutton的事件学习的更多相关文章

  1. jquery mobile Checkbox动态添加刷新及事件绑定

    jquery mobile Checkbox动态添加刷新及事件绑定 在微信项目中,涉及到一个多选功能.数据来自后台数据库,需要动态加载. 项目结构:微信api+web app.使用jquery mob ...

  2. jQuery Mobile里xxx怎么用呀? (事件篇)

    jQuery Mobile里$(document).ready()怎么用呀? 相关链接: http://stackoverflow.com/questions/14468659/jquery-mobi ...

  3. [转]使用 jQuery Mobile 与 HTML5 开发 Web App —— jQuery Mobile 事件详解

    在前文<使用 jQuery Mobile 与 HTML5 开发 Web App —— jQuery Mobile 默认配置与事件基础>中,Kayo 对 jQuery Mobile 事件的基 ...

  4. jQuery Mobile方向感应事件

    在现在的智能手机中,都有对方向变换的自动感知功能,比如当手机方向从水平方向切换到垂直方向时,则会触发该事件.在jQuery Mobile中,可以通过orientationchange事件进行绑定,并且 ...

  5. Jquery Mobile事件

    Jquery Mobile事件参考手册 on()方法用于添加事件处理程序 1.Touch类事件 在用户触摸屏幕时触发 1.1 tap事件 用户敲击某个元素时发生 $("p").on ...

  6. jQuery Mobile 页面事件

    jQuery Mobile 页面事件 在 jQuery Mobile 中与页面打交道的事件被分为四类: Page Initialization - 在页面创建前,当页面创建时,以及在页面初始化之后 P ...

  7. 利用JQuery Mobile开发web app

    什么是web app web app 是基于web的应用程序,是针对移动设备优化后的web站点,它具有 开发成本低——采用web开发技术,不需要考虑跨平台以及底层适配问题: 升级简单——不需要通知用户 ...

  8. jquery mobile 移动web(6)

    jquery mobile 针对移动端设备的事件类型. 1.touch 事件. tap 快速触摸屏幕并且离开,类似一种完整的点击操作. taphold 触摸屏幕并保持一段时间. swipe 在1秒内水 ...

  9. HTML5开发移动web应用—JQuery Mobile(1)

    JQuery Mobile是一个简单易用的web移动app开发框架.使用它就像使用jQuery一样,引入必要的文件就可以. 最基础的jQuery Mobile文件的结构代码例如以下: <body ...

随机推荐

  1. debian添加中文支持

    转载:http://www.shunix.com/debian-chinese-support-472/   debian与ubuntu有很大的相似性,但是debian相对更原始,比如在语言支持这一块 ...

  2. C#监控文件夹变化

    当需要监控某一文件,FileSystemWatcher类提供了Created, Deleted,Rename等事件. 就拿FileSystemWatcher的Created事件来说,该事件类型是Fil ...

  3. 报错:无法从int?转换为int

    □ 背景分析 在控制器方法中的一个参数允许为null值:public ActionResult GetByCategory(int? categoryId = null) 当把这里的categoryI ...

  4. 为免费app嵌入Admob广告

    为免费app嵌入Admob广告,进而获得广告收入. 1.http://www.admob.com/注册一个帐号, 添加Add Mobile Site/app,输入相关信息后,提交完成, 下载Andro ...

  5. [翻译] 5点建议,让iOS程序跑得更快

      [文章原地址]http://mobile.tutsplus.com/tutorials/iphone/ios-quick-tip-5-tips-to-increase-app-performanc ...

  6. Eclipse 搭建struts2 spring3 hibernate3环境实战 待完善

    1.struts2 目前是2.3版本,下载地址http://struts.apache.org/download.cgi struts2包 struts2-core-2.3.16.3.jar stru ...

  7. [Mongo] 解决mongoose不支持条件操作符 $gt$gte:$lte$ne $in $all $not

    reference : http://blog.sina.com.cn/s/blog_4df23d840100u25x.html 找到mongoose的安装目录 /usr/local/lib/node ...

  8. <mvc:annotation-driven />做了什么

    <mvc:annotation-driven /> 是一种简写形式,完全可以手动配置替代这种简写形式,简写形式可以让初学都快速应用默认配置方案.<mvc:annotation-dri ...

  9. Tengine zabbix 监控

    Tengine 配置 在http 段下新增以下配置 req_status_zone server_stat "$host" 3M; server { listen 9008; lo ...

  10. 同一页面的两个Iframe获取数据

    首先页面: <td style="width: 50%" valign="top"> <iframe name="xxx" ...