jQuery Mobile pagehideEvent

jQuery Mobile 事件jQuery Mobile Events

Examples

Pop up some text information after the old page is hidden after a page transition:

$(document).on("pagehide","#pagetwo",function(){
alert("pagehide event fired - page 2 hidden");
});

Try it Yourself »

Definition and Usage

The pagehide event is triggered after the old page is hidden after a page transition.

Related events:

  • pagebeforehide- The event triggered before the old page is hidden after a page transition.
  • pagebeforeshow- The event triggered before display after a page transition.
  • pageshow- The event triggered after display after 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){...}) Try it Yourself

Trigger the event for a specified page:

$("document").on("pagehide","page",function(event,data){...}) Try it Yourself

Parameters Description
function(event,data) Required. Specifies the function to execute when the pagehide 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 to thejQuery Event Reference Manual
  • Data object- Contains the property nextPage, the transition page to return.
page Optional. Specifies the id of the page pointed to when the pagehide event is triggered. For internal pages, use#id. For external pages, use externalfile.html。


实例

More Examples

Related events demo
This example demonstrates the triggering of the 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