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

jQuery Mobile pagebeforehide Event

jQuery Mobile pagebeforehide Event

jQuery Mobile Events jQuery Mobile Events

Example

Text pops up after a page transition and before the old page is hidden:

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

  alert("pagebeforehide event triggered - page two is about to be hidden");

});

Try it »


Definition and Usage

pagebeforehide is an event triggered after a page transition and before the old page is hidden.

Related events:

Note: This event is triggered at the start/end of a page transition.


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, refer to the jQuery event reference manual
  • Data object - Contains the property nextPage, the transition page to return.
  • | | *page* | Optional. Specifies the page id pointed to when the pagebeforehide event is triggered. For internal pages, please use *#id*. For external pages, please 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