jQuery Mobile pageshow Event | Tutorial
Tutorial -- Learning is not just about technology, but also about dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
jQuery Mobile Tutorial
jQuery Mobile Tutorial jQuery Mobile Introduction jQuery Mobile Installation jQuery Mobile Pages jQuery Mobile Transitions jQuery Mobile Buttons jQuery Mobile Button Icons jQuery Mobile Popups jQuery Mobile Toolbars jQuery Mobile Navigation Bars jQuery Mobile Panels jQuery Mobile Collapsibles jQuery Mobile Tables jQuery Mobile Grids
jQuery Mobile Lists
jQuery Mobile List Views jQuery Mobile List Content jQuery Mobile Filters
jQuery Mobile Forms
jQuery Mobile Form Basics jQuery Mobile Form Inputs jQuery Mobile Form Select jQuery Mobile Form Sliders
jQuery Mobile Themes
jQuery Mobile Events
jQuery Mobile Events jQuery Mobile Touch Events jQuery Mobile Scroll Events jQuery Mobile Orientation Change Events jQuery Mobile Examples jQuery Mobile Data Attributes jQuery Mobile Icons jQuery Mobile Events jQuery Mobile Page Events jQuery Mobile CSS Classes
jQuery Mobile pageshow Event
Example
Alert a message after the page is shown following a page transition:
$(document).on("pageshow","#pagetwo",function(){
alert("pageshow event triggered - showing page two");
});
Definition and Usage
The pageshow event is triggered after a page is shown following a page transition.
Related Events:
- pagebeforeshow - Triggered before a page is shown following a page transition.
- pagebeforehide - Triggered before the old page is hidden following a page transition.
- pagehide - Triggered after the old page is hidden following a page transition.
Note: This event is triggered at the start/end of a page transition.
Syntax
To trigger all page events in jQuery Mobile:
$("document").on("pageshow",function(event){...})
To trigger a specific page event:
$("document").on("pageshow","_page_",function(event,data){...})
| Parameter | Description |
|---|---|
| function(event,data) | Required. The function to run when the pageshow event is triggered. This function contains two parameters: * event object - Includes any jQuery event properties (event.target, event.type, etc.). For more information, see the jQuery Event Reference. * data object - Contains the property nextPage, which is the page to transition to. |
| _page_ | Optional. Specifies the page id the pagebeforehide event points to when triggered. For internal pages, use #id. For external pages, use externalfile.html. |
More Examples
This example demonstrates the triggering of the pagebeforeshow, pageshow, pagebeforehide, and pagehide events.
Use event.type to return the triggered event type vertically.
Use the prevPage property to return the previous page.
YouTip