Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Mobile pagehide event

jQuery Mobile pagehide event

jQuery Mobile Events jQuery Mobile Events

Example

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

$(document).on("pagehide","#pagetwo",function(){

  alert("pagehide event triggered - page two hidden");

});

Try it »


Definition and Usage

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

Related events:

Note: This event is triggered each time a page transition starts/stops.


Syntax

Trigger the event for all pages in jQuery Mobile:

$("document").on("pagehide",function(event){...})

Try it

Trigger the event for a specified page:

$("document").on("pagehide","

page

",function(event,data){...})

Try it

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, refer to the jQuery event reference manual
  • Data object - Contains the property nextPage, the transition page to return.
  • | | *page* | Optional. Specifies the id of the page the pagehide event points to. For internal pages, use *#id*. For external pages, use * externalfile.html*. |

    More examples

    Related events demonstration
    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 Events jQuery Mobile Events