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

jQuery Mobile pageshow event

jQuery Mobile pageshow event

jQuery Mobile Events jQuery Mobile Events

Example

Pop up a message after the page is displayed following a transition:

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

  alert("pageshow event triggered - showing page two");

});

Try it »


Definition and Usage

pageshow is an event triggered after a page is displayed following a transition.

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("pageshow",function(event){...})

Try it

Trigger a specified page event:

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

page

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

Try it

Parameters Description
function(event,data) Required. Specifies the function to execute when the pageshow 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 pagebeforehide 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 event.type to return the type of the triggered event.

    Data object
    Use the prevPage property to return the previous page.


    jQuery Mobile Events jQuery Mobile Events