Get to page from page before change event
Description
The following code shows how to get to page from page before change event.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.7.1.js'></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css">
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){<!-- w w w . j a va 2 s . c om-->
$(document).bind("pagebeforechange", function ( event , data) {
console.log('To Page: '+data.toPage);
});
});//]]>
</script>
</head>
<body>
<div data-role="page" id="home">
<p>Open up the console and Click the Info link</p>
<ul>
<li><a href="#info">Info</a></li>
</ul>
</div>
<div data-role="page" id="info">
<ul>
<li><a href="#home">Home</a></li>
</ul>
</div>
</body>
</html>