JQuery Mobile – Lesson 01 – Basic page Template
Lesson 01 | Lesson 02 | Lesson 03 | Lesson 04 | Lesson 05
1. <Optional> Download JQuery Mobile from http://jquerymobile.com/download/.
2. Or just the use the following code between <head> tags of HTML document:
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
3. Use the following HTML5 template:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Page title</title>
</head>
<body>
</body>
</html>
4. Add data-role div for page, header, main and footer to every page at your application according to the following template:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Page title</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" /> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <div data-role="page"> <div data-role="header"> </div> <div data-role="main" class="ui-content"> </div> <div data-role="footer"> </div> </div> </body> </html>
5. Try the following code which is the same as #4 but with two divs of page:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Page title</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" /> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <div data-role="page"> <div data-role="header"> <h1>Page 1 header</h1> </div> <div data-role="main" class="ui-content"> <h1>Page 1 Main</h1> </div> <div data-role="footer"> <h1>Page 1 footer</h1> </div> </div> <div data-role="page"> <div data-role="header"> <h1>Page 2 header</h1> </div> <div data-role="main" class="ui-content"> <h1>Page 2 Main</h1> </div> <div data-role="footer"> <h1>Page 2 footer</h1> </div> </div> </body> </html>
6. As you can see, div of page 2 is not visible.