jQuery Mobile pagebeforehideEvents
Examples
Pop up a text message before the old page is hidden after page switching:
$(document).on("pagebeforehide","#pagetwo",function(){
alert("pagebeforehide \n\tevent triggered - page two is about to be hidden");
});
alert("pagebeforehide \n\tevent triggered - page two is about to be hidden");
});
Try it »
Definition and Usage
The pagebeforehide event is triggered before the old page is hidden after page switching.
Related events:
- pagehide- The event triggered after the old page is hidden after page switching.
- pagebeforeshow- The event triggered before showing after page switching.
- pageshow- The event triggered after showing after page switching.
Note:This event is triggered when the page transition starts/ends.
Syntax
Trigger all page events in jQuery Mobile:
$("document").on("pagebeforehide",function(event){...})
Try it
Trigger a specified page event:
$("document").on("pagebeforehide","page",function(event){...})
Try it
| Parameters | Description |
|---|---|
| function(event,data) | Required. Specifies the function to execute when the pagebeforehide event is triggered. This function contains the following two parameters:
|
| page | Optional. Specifies the page id that the pagebeforehide event points to when triggered. For internal pages, use#id. For external pages, use externalfile.html. |

More Examples
Demonstration of related events.
This example demonstrates the triggering of pagebeforeshow,
pageshow, pagebeforehide, and pagehide events.
Event object
Use the event.timeStamp property.
Data object
Use the nextPage property to return the transition page.
Other extensions
jQuery Mobile Events