jQuery Mobile pagebeforehideEvents

jQuery Mobile 事件jQuery Mobile Events

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");
});

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:

  • Event object- Includes any jQuery event properties (event.target, event.type, etc.). For more information, please refer tojQuery Event Reference Manual
  • Data object- Contains the property nextPage, the transition page to be returned.
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.


实例s

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.


jQuery Mobile 事件jQuery Mobile Events

Other extensions