Latest web development tutorials

jQuery Mobile pageload event

jQuery Mobile Events jQuery Mobile Events

Examples

In the external page loads successfully inserted into the DOM and pop-up information:

$ (Document) .on ( "pageload", function () {
alert ( "pageload event trigger!");
});

try it"

Definition and Usage

After the 1.4.0 version is obsolete, use pagecontainerload instead.

pageload event page and successfully loaded into the DOM after the trigger.

Related events:

Note: The external page is loaded into the DOM, the event will certainly trigger type 2. Before loading the pagebeforeload event, and after loading pageload (loaded successfully) or pageloadfailed (failed to load).


grammar

$("document").on("pageload",function(event,data){...})

参数 描述
function(event,data) pageload 事件触发后指定执行的函数

该函数含有以下两个参数:

事件对象 - 包括任何jQuery事件属性 ( event.target, event.type 等) 。更多信息请查阅 jQuery 事件参考手册

数据对象 - 包含以下类型:

  • url (string) - 通过回调传到$.mobile.loadPage()的绝对或者相对地址
  • absUrl (string) - 包含URL的绝对引用
  • dataUrl (string) - 包含浏览器的URL 位置
  • options (object) - 包含可选项发送到 $.mobile.loadPage()
  • xhr (object) - 包含 XMLHttpRequest 对象 (作为第三个参数发送到 $.ajax() 成功回调)
  • textStatus (string 或者 null) - 包含请求状态 ("success" 或 "null") (作为第二个参数发送到 $.ajax() 失败回调)


Examples

More examples

Related events demonstrate.
pageload and presentation pageloadfailed events.

Event objects
Use event.type property to return the type of trigger event.

Data Objects
Use data.url return external URL of the page.


jQuery Mobile Events jQuery Mobile Events