一、页面初始化事件(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. Navicat

    create table <表名>(    <列名> <数据类型及长度> [not null],    <列名> <数据类型及长度>,   ...

  2. Codecademy For Python学习笔记

    一.Python Lists and Dictionaries: 1. 2.

  3. git的使用--不错的博客【转】

    转自:http://www.cnblogs.com/wang_yb/p/3867221.html GIT 的常规操作 常规操作也是我自己平时常用的几个命令, 学自于 pro git 这本书中 git ...

  4. linux内核编程笔记【原创】

    以下为本人学习笔记,如有转载请注明出处,谢谢 DEFINE_MUTEX(buzzer_mutex); mutex_lock(&buzzer_mutex); mutex_unlock(& ...

  5. 【AStar】初赛第一场

    1. All X1.1 基本思路k和c的范围都不大,因此可以考虑迭代找循环节,然后求余数,判定是否相等.这题还是挺简单的.1.2 代码 /* 5690 */ #include <iostream ...

  6. Hadoop集群(第10期)_MapReduce与MySQL交互

    2.MapReduce与MySQL交互 MapReduce技术推出后,曾遭到关系数据库研究者的挑剔和批评,认为MapReduce不具备有类似于关系数据库中的结构化数据存储和处理能力.为此,Google ...

  7. EditText控件实现只读

      android的EditText控件实现只读只需设置三个方法: editText.setCursorVisible(false);//隐藏光标 editText.setFocusable(fals ...

  8. DELPHI 里面的迭代

    迭代(Iiterator)的作用:遍历一个集合(Collections)的每一个元素(item). delphi 2005之后新加入一种 for .. in .. 遍历语句,支持String,Set, ...

  9. UVa 10106 Product

    高精度乘法问题,WA了两次是因为没有考虑结果为0的情况.  Product  The Problem The problem is to multiply two integers X, Y. (0& ...

  10. 如何使用USB安装XenServer 6.x

    在XenServer 5.6以前我们能够很容易的通过一些工具,直接制作USB安装介质,然后快速安装XenServer,但是我们发现,到XenServer6.0以后,通过工具直接制作的XenServer ...