Handle page show event for each page
Description
The following code shows how to handle page show event for each page.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.6.4.js'></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.css">
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js"></script>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){<!-- w ww. j a v a 2 s . com-->
$('#home').live( 'pageshow',function(event, ui){
alert( 'We are back home');
});
$('#page2').live( 'pageshow',function(event, ui){
alert( 'This will only execute on Page 2');
});
});//]]>
</script>
</head>
<body>
<div data-role="page" id="home">
<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="c"
data-dividertheme="f">
<li data-role="list-divider">Overview</li>
<li><a href="#page2">Page 2</a></li>
</ul>
</div>
</div>
<div data-role="page" id="page2">
<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="c"
data-dividertheme="f">
<li data-role="list-divider">Overview</li>
<li><a href="#home">Go Back Home</a></li>
</ul>
</div>
</div>
</body>
</html>