jQuery Mobile pagehide Event
Example
Display an alert message after the old page is hidden following a page transition:
$(document).on("pagehide","#pagetwo",function(){
alert("pagehide event triggered - Page Two hidden");
});
Definition and Usage
The pagehide event is triggered after the old page is hidden following a page transition.
Related Events:
- pagebeforehide - Triggered before the old page is hidden following a page transition.
- pagebeforeshow - Triggered before the new page is displayed following a page transition.
- pageshow - Triggered after the new page is displayed following a page transition.
Note: This event is triggered every time a page transition starts/stops.
Syntax
Trigger the event for all pages in jQuery Mobile:
$("document").on("pagehide",function(event){...})
Trigger the event for a specified page:
$("document").on("pagehide","_page_",function(event,data){...})
| Parameter | Description |
|---|---|
| function(event,data) | Required. Specifies the function to run when the pagehide event is triggered. This function contains the following two parameters:
|
| _page_ | Optional. Specifies the page ID that the pagehide event points to when triggered. For internal pages, use #id. For external pages, use externalfile.html. |
More Examples
This example demonstrates the triggering of the pagebeforeshow, pageshow, pagebeforehide, and pagehide events.
Using the event.timeStamp property.
Using the nextPage property to return the transitioning page.
YouTip