jQuery Mobile pagecontainerloadEvent

jQuery Mobile 事件jQuery Mobile Events

Example

Pop up a text message after the page is successfully loaded and inserted into the DOM:

$(document).on("pagecontainerload",function(){
alert("pagecontainerload event triggered!");
});

Try it Yourself »

Definition and Usage

The pagecontainerload event is triggered after the page is successfully loaded and inserted into the DOM.

Related events:

  • pagecontainerbeforeload - Triggered before the load request
  • pagecontainerloadfailed- Triggered when the page request fails

Note:This event is for external pages - after the page is loaded and inserted into the DOM, 2 events will be triggered. The first event is pagecontainerbeforeload, and the second event may be pagecontainerload or pagecontainerloadfailed.


Syntax

$("document").on("pagecontainerload",function(event,data){...})
Parameter Description
function(event,data) Required. Specifies the function to execute after the event is triggered.

This function has two optional parameters:

event object- Contains jQuery event properties (such as: event.target, event.type, etc.), seejQuery Event Reference Manualfor more information.

data object- Contains the following:

  • url(string) - The absolute or relative URL address of the page (sent to $.mobile.loadPage())
  • absUrl(string) - The absolute path of the URL
  • dataUrl(string) - The corresponding URL address in the browser
  • deferred(object) - Contains resolve() or reject()
  • options(object) - Optional items sent to $.mobile.loadPage()
Note:In the event object, you can manually handle the request by calling event.preventDefault(). The deferred object in the data object contains the resolve() or reject() methods.
实例

More Examples

Related event demos
Demonstration of the pagecontainerload and pagecontainerloadfailed events.

event object
Use the event.type property to return the type of event triggered.

data object
Use data.url to return the URL address of the external page.

Other Extensions