jQuery Mobile pageshow event
Example
Pop up a message after the page is displayed following a transition:
$(document).on("pageshow","#pagetwo",function(){
alert("pageshow event triggered - showing page two");
});
Try it »
Definition and Usage
pageshow is an event triggered after a page is displayed following a transition.
Related events:
- pagebeforeshow - The event triggered before display following a page transition.
- pagebeforehide - The event triggered before the old page is hidden following a page transition.
- pagehide - The event triggered after the old page is hidden following a page transition.
Note: This event is triggered at the start/end of a page transition.
Syntax
Trigger all page events in jQuery Mobile:
$("document").on("pageshow",function(event){...})
Try it
Trigger a specified page event:
$("document").on("pageshow","
page
",function(event,data){...})
Try it
| Parameters | Description |
|---|---|
| function(event,data) | Required. Specifies the function to execute when the pageshow event is triggered.
This function contains the following two parameters: |
More examples
Related events demonstration.
This example demonstrates the triggering of the pagebeforeshow, pageshow, pagebeforehide, and pagehide events.
Event Object
Use event.type to return the type of the triggered event.
Data object
Use the prevPage property to return the previous page.
jQuery Mobile Events