pageshow


pageshow eventversion added: 1.0

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

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

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

  • prevPage (object)
    • A jQuery collection object that contains the page DOM element that we just transitioned away from. Note that this collection is empty when the first page is transitioned in during application startup.

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.