jQuery Mobile 页面事件总结
一、页面初始化事件(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) 当外部页面加载时、卸载时或加载失败时
- 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) 在页面过渡之前和之后,每次过渡时都会触发。
- 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 页面事件总结的更多相关文章
- jQuery Mobile 页面事件
jQuery Mobile 页面事件 在 jQuery Mobile 中与页面打交道的事件被分为四类: Page Initialization - 在页面创建前,当页面创建时,以及在页面初始化之后 P ...
- jQuery Mobile页面跳转切换的几种方式
jQuery Mobile在移动开发中越来越受到欢迎. 而他的各个版本号也在持续不断的更新中.相同的我也非常喜欢它,它加快了我们开发HTML5的速度. 同一时候又具备jQuery一样的操作方法. 学起 ...
- [ Talk is Cheap Show me the CODE ] : jQuery Mobile页面布
[ Talk is Cheap Show me the CODE ] : jQuery Mobile页面布局 当我们专注地研究人类生活的空虚,并考虑荣华富贵空幻无常时,或许我们正在阿谀逢迎自己懒惰的天 ...
- (二)Jquery Mobile介绍以及Jquery Mobile页面与对话框
Jquery Mobile介绍以及Jquery Mobile页面与对话框 一. Adobe Dreamweaver CS6 环境 最新版本的cs6会支持JM的使用,有自动提示功能,很强大.安装说明地 ...
- 用谷歌浏览器Chrome浏览jQuery Mobile页面需要配置Tomcat服务器
在浏览jQuery Mobile 页面中,除了 Chrome浏览器出错外,其他的浏览器都ok: 这里,是因为需要单独配置 Tomcat 服务: 1.先配置java jdk: 2.下载,安装,配置,To ...
- 02.Jquery Mobile介绍以及Jquery Mobile页面与对话框
一.为什么要学Jquery Mobile JqueryMobile 是jquery的移动版本,懂基本的jquery知识,会简单的html+css就可以完成很多复杂的功能,还有就是这个框架在企业中用 ...
- jQuery Mobile页面返回无需重新get
最近公司的web app项目,使得我有幸一直接触和学习jQuery Mobile.这确实是一个很不错的移动开发库,有助于擅长web开发的工程师,快速入门并构建自己的移动应用.但是在前两天,我碰到了一个 ...
- jquery mobile Touch事件
Touch事件在用户触摸屏幕(页面)时触发 1.jquery mobile tap tap事件在用户敲击某个元素时触发 $("p").on("tap",fucn ...
- JQuery Mobile 页面参数传递
在单页模版中使用基于HTTP的方式通过POST和GET请求传递参数,而在多页模版中不需要与服务器进行通信,通常在多页模版中有以下三种方法来实现页面间的参数传递. 1.GET方式:在前一个页面生成参数并 ...
随机推荐
- ColorDescriptor software v4.0 一个提取颜色特征描述子的软件包
ColorDescriptor software v4.0 Created by Koen van de Sande, (c) University of Amsterdam Note: Any co ...
- SUN dataset图像数据集下载
SUN dataset数据集,有两个不错的网址: http://vision.princeton.edu/projects/2010/SUN/ (普林斯顿大学) http://groups.csail ...
- 利用SOLR搭建企业搜索平台 之——配置文件
运行solr是个很简单的事,如何让solr高效运行你的项目,这个就不容易了.要考虑的因素太多.这里很重要一个就是对solr的配置要了解.懂得配置文件每个配置项的含义,这样操作起来就会如鱼得水! 在so ...
- HDU 4652 Dice(期望)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4652 题意:一个m个面的筛子.两种询问:(1)平均抛多少次后使得最后n次的面完全一样:(2)平均抛多少 ...
- HeadFirst Jsp 05 (属性和监听)
活用DD, 比如, 我想设置一个email地址, 但是不像在servlet中硬编码, 如果能再web.xml中设置一个参数, 直接拿到这个参数就更好一点. 容器建立一个servlet时, 它会读DD( ...
- hdu3270Arranging Your Team(dfs)
http://acm.hdu.edu.cn/showproblem.php?pid=3720 #include <iostream> #include<cstdio> #inc ...
- Android uiautomator gradle build system
This will guide you through the steps to write your first uiautomator test using gradle as it build ...
- 【笨嘴拙舌WINDOWS】GDI绘制区域
在默认情况下,Gdi绘画操作的使用白纸(窗口的客户区)黑字(Pen的颜色)!前面我们已经讲过如何改笔,现在来学习改变白纸(GDI的绘制区域) 正常的纸为一个矩形形状!有时候小孩不小心撕掉纸的一角,不小 ...
- UVa 10635 (LIS+二分) Prince and Princess
题目的本意是求LCS,但由于每个序列的元素各不相同,所以将A序列重新编号{1,2,,,p+1},将B序列重新编号,分别为B中的元素在A中对应出现的位置(没有的话就是0). 在样例中就是A = {1 7 ...
- Java条件语句之 switch
当需要对选项进行等值判断时,使用 switch 语句更加简洁明了.例如:根据考试的名次,给予前 4 名不同的奖品.第一名,奖励笔记本一台:第二名,奖励 IPAD 2 一个:第三名,奖励移动电源一个:最 ...