pagehide


pagehide eventversion added: 1.0

Description: Triggered on the "fromPage" after the transition animation has completed.

  • jQuery( ".selector" ).on( "pagehide", function( event ) { ... } )

Callbacks for this event will receive a data object as their 2nd arg. This data object has the following properties on it:

  • nextPage (object)
    • A jQuery collection object that contains the page DOM element that we just transitioned to.

Note that this event will not be dispatched during the transition of the first page at application startup since there is no previously active page.

You can access the prevPage or nextPage properties via the second argument of a bound callback function. For example:

1
2
3
4
5
6
7
$( "div" ).on( "pageshow", function( event, ui ) {
alert( "This page was just hidden: " + ui.prevPage );
});
$( "div" ).on( "pagehide", function( event, ui ) {
alert( "This page was just shown: " + ui.nextPage );
});

Also, for these handlers to be invoked during the initial page load, you must bind them before jQuery Mobile executes. This can be done in the mobileinit handler, as described on the global config page.