一、页面初始化事件(Page initiallization) 在页面创建前,当页面创建时,以及在页面初始化之后。只在第一次加载时执行。

1. pagebeforecreate 页面创建前

[sourcecode language="plain"]

$(document).on("pagebeforecreate", function(){
console.log("执行pagebeforecreate");
});

[/sourcecode]

2. pagecreate页面创建时

[sourcecode language="plain"]

$(document).on("pagecreate",
function(){
console.log("执行pagecreate");
});
[/sourcecode]

3. pageinit 页面初始化之后

[sourcecode language="plain"]

$(document).on("pageinit",
function(){
console.log("执行pageinit");
});
[/sourcecode]

二、页面加载事件(Page Load/Unload) 当外部页面加载时、卸载时或加载失败时

  1. pagebeforeload

[sourcecode language="plain"]

$(document).on("pagebeforeload", function(event,
data){
console.log("执行pagebeforeload" +
data.url);
});
[/sourcecode]

2. pageload

[sourcecode language="plain"]

$(document).on("pageload", function(event, data){
console.log("执行pageload"
+ data.url);
});
[/sourcecode]

三、页面过渡事件(Page Transition) 在页面过渡之前和之后,每次过渡时都会触发。

  1. pagebeforeshow

[sourcecode language="plain"]

$(document).on("pagebeforeshow", "#index2",
function(){
console.log("index-pagebeforeshow");
});

[/sourcecode]

2. pageshow(常用)

[sourcecode language="plain"]

$(document).on("pageshow", "#index2",
function(){
console.log("index-pageshow");
});
[/sourcecode]

3. pagebeforehide

[sourcecode language="plain"]

$(document).on("pagebeforehide", "#index",
function(){
console.log("index-pagebeforehide");
});
[/sourcecode]

4. pagehide

[sourcecode language="plain"]

$(document).on("pagehide", "#index",
function(){
console.log("index-pagehide");
});
[/sourcecode]

页面index过渡到index2,执行顺序为:

a. 页面index的 pagebeforehide

b. 页面index2的pagebeforeshow

c. 页面index的 pagehide

d. 页面index2的 pageshow

注意:pageinit和pageshow的区别,
pageinit初始化一次,pageshow每次进入页面都会执行。

查看原文:http://www.haojianhua.com/2015/09/23/jquery-mobile-页面事件总结/

jQuery Mobile 页面事件总结的更多相关文章

  1. jQuery Mobile 页面事件

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

  2. jQuery Mobile页面跳转切换的几种方式

    jQuery Mobile在移动开发中越来越受到欢迎. 而他的各个版本号也在持续不断的更新中.相同的我也非常喜欢它,它加快了我们开发HTML5的速度. 同一时候又具备jQuery一样的操作方法. 学起 ...

  3. [ Talk is Cheap Show me the CODE ] : jQuery Mobile页面布

    [ Talk is Cheap Show me the CODE ] : jQuery Mobile页面布局 当我们专注地研究人类生活的空虚,并考虑荣华富贵空幻无常时,或许我们正在阿谀逢迎自己懒惰的天 ...

  4. (二)Jquery Mobile介绍以及Jquery Mobile页面与对话框

    Jquery Mobile介绍以及Jquery Mobile页面与对话框  一. Adobe Dreamweaver CS6 环境 最新版本的cs6会支持JM的使用,有自动提示功能,很强大.安装说明地 ...

  5. 用谷歌浏览器Chrome浏览jQuery Mobile页面需要配置Tomcat服务器

    在浏览jQuery Mobile 页面中,除了 Chrome浏览器出错外,其他的浏览器都ok: 这里,是因为需要单独配置 Tomcat 服务: 1.先配置java jdk: 2.下载,安装,配置,To ...

  6. 02.Jquery Mobile介绍以及Jquery Mobile页面与对话框

    一.为什么要学Jquery Mobile   JqueryMobile 是jquery的移动版本,懂基本的jquery知识,会简单的html+css就可以完成很多复杂的功能,还有就是这个框架在企业中用 ...

  7. jQuery Mobile页面返回无需重新get

    最近公司的web app项目,使得我有幸一直接触和学习jQuery Mobile.这确实是一个很不错的移动开发库,有助于擅长web开发的工程师,快速入门并构建自己的移动应用.但是在前两天,我碰到了一个 ...

  8. jquery mobile Touch事件

    Touch事件在用户触摸屏幕(页面)时触发 1.jquery mobile tap tap事件在用户敲击某个元素时触发 $("p").on("tap",fucn ...

  9. JQuery Mobile 页面参数传递

    在单页模版中使用基于HTTP的方式通过POST和GET请求传递参数,而在多页模版中不需要与服务器进行通信,通常在多页模版中有以下三种方法来实现页面间的参数传递. 1.GET方式:在前一个页面生成参数并 ...

随机推荐

  1. OTP【转】

    转自:http://baike.baidu.com/link?url=58z3oZfEMvNRiDUmWrxtzfDhv--UZ1jaW4rBHg1d9kIWd6HQaYZ96DH8QAFopSZBK ...

  2. Mac 版 QQ 可直接访问 iPhone 的相册 ?!

    在QQ的聊天窗口中,点击 发送图片 的按钮,会有两个选择项,其中一个就是 从iPhone相册中选取 ,如图 点击  从iPhone相册中选取 后,iPhone上的QQ会收到一条消息 “请选择要上传的照 ...

  3. KMP,模式匹配算法

    [QQ群: 189191838,对算法和C++感兴趣可以进来] 我们经常会遇到一种情况是匹配两个字符串,看strPar中是否含有str子串,如果有则返回子串在父串strPar中的位置,如果不存在则返回 ...

  4. 加密解密(6)RSA算法过程图解

    转自: http://blog.csdn.net/21aspnet/article/details/7249401 RSA算法 RSA公钥加密算法是1977年由Ron Rivest.Adi Shami ...

  5. [HDOJ1171]Big Event in HDU(01背包)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1171 许多有价值的物品,有重复.问如何将他们分成两堆,使两堆价值之差最小. 对价值求和,转换成01背包 ...

  6. 启用ntp服务

    1. 主服务器 修改配置vi /etc/ntp.conf restrict 192.168.2.0 mask 255.255.255.0 nomodify notrap #允许别的服务器同步 serv ...

  7. tc srm 636 div2 500

    100的数据直接暴力就行,想多了... ac的代码: #include <iostream> #include <cstdio> #include <cstring> ...

  8. Machine Learning for hackers读书笔记(五)回归模型:预测网页访问量

    线性回归函数 model<-lm(Weight~Height,data=?) coef(model):得到回归直线的截距 predict(model):预测 residuals(model):残 ...

  9. WebForm页面生命周期及asp.net运行机制

    1.先上几张原理图着重理解: 现在针对第四副图原理进行解析: 流程: 1.浏览器发送请求 2.服务器软件(IIS)接收,它最终的目的就是为了向客户输出它请求的动态页面生成的html代码. 3.服务器不 ...

  10. mysql 调用带返回值的存储过程

    存储过程: create procedure proc_t(out uname varchar(50),out upwd varchar(50),in uid int) BEGIN select na ...