jQuery pagecreate event
Examples
When the page is initialized, enhanced pop-up message ago:
alert ( "pagecreate event trigger!")
});
try it"
Definition and Usage
pagecreate event after the page is created, the trigger, but in jQuery Mobile enhanced page before completion.
Note: This event can only be triggered once per page - when the page is first loaded, jQuery Mobile in the DOM (memory) cache pages, so when your browser fallback from the first second page when the page, the event will not be triggered because the first page has been initialized.
Note: Before version 1.4, we use pageinit events (obsolete) to deal with.
Note: This event is often used to customize the user wants to enhance the components:
$(document).on("pagecreate","#pagetwo",function(event){ $.(":jqmData(role='my-plugin')").myPlugin(); });
Related events:
- pagebeforecreate - triggered after the page is initialized, but before the page is enhanced.
- pageinit - triggered after the page has fully initialized and completed enhancement.
grammar
In jQuery Mobile page for all trigger events:
Trigger event for the specified page:
parameter | description |
---|---|
function (event) | have to. Function is executed pagecreate specified event triggers. Function has an optional event object, you can protect any jQuery event properties (event.target, event.type, etc. for more information please refer to the jQuery Event Manual . |
page | Optional. It is used to specify an event triggered pagebeforecreate page id. Inside page, please use #id. External page, use externalfile.html. |
More examples
pagebeforecreate event instances and pagecreate
This example shows the trigger pagebeforecreate and pagecreate events.
Event objects
Use event.type property to return the type of trigger event.