Monday, July 30, 2012

Create JQuery Mobile Multiple page


<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
</head>

<body>
<!--   Page1 Start  -->
<div data-role="page" id="page1">

<div data-role="header">
<h1>Page 1</h1>
</div>

<div data-role="content">
<p>Page1 content goes here. Its a Page1.</p>
<a href="#page2" data-role="button" >Page2</a>
</div>
<div data-role="footer">
<h4>Page1 Footer</h4>
</div>
</div>
<!--  Page1 End  -->

<!--  Page2 Start  -->
<div data-role="page" id="page2">

<div data-role="header">
<h1>Page2 Title</h1>
</div>

<div data-role="content">
<p>Page2 content goes here. welcome to page2.</p>
<a href="#page2" data-role="button" data-rel="back" >Page1</a>
</div>

<div data-role="footer">
<h4>Page2 Footer</h4>
</div>
</div>
<!-- Page2 End-->

</body>
</html>

You can also change page through the JavaScript.
function loadpage2{
   $.mobile.changePage( "#page2", { transition: "slideup"} );
}

No comments:

Post a Comment