jQuery Mobile pagebeforeshow Event
Example
Text pops up after a page transition and before display:
$(document).on("pagebeforeshow","#pagetwo",function(){
alert("pagebeforeshow event triggered - page two is about to be shown");
});
Try it »
Definition and Usage
pagebeforeshow is an event triggered after a page transition and before display.
Related events:
- pageshow - The event triggered after 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/stop of each transitioning page.
Syntax
To trigger the event for all pages in jQuery Mobile:
$("document").on("pagebeforeshow",function(event){...})
Try it
Trigger an event for a specified page:
$("document").on("pagebeforeshow","
page
",function(event,data){...})
Try it
| Parameters | Description |
|---|---|
| function(event,data) | Required. Specifies the function to execute when the pagebeforeshow event is triggered.
This function contains the following two parameters: |
More examples
Demo related events
This example demonstrates the triggering of the pagebeforeshow, pageshow, pagebeforehide, and pagehide events.
Event Object
Use the event.type property to return the type of event that was triggered.
Data object
Use the prevPage property to return the previous page of the transition.
jQuery Mobile Events