JQueryMobile Android Programming
JQueryMobile Android Programming
Copyright ©, All rights reserved. 2011 SDSU & Roger Whitney, 5500
Campanile Drive, San Diego, CA 92182-7700 USA. OpenContent (http://
www.opencontent.org/opl.shtml) license defines the copyright on this
document.
jQuery Mobile
Free
Based on jQuery
Unified interface on most mobile browsers
Alpha 3 release
Announced August 2010
10
11
iOS Y Y
BlackBerry OS
Y Y
v5.0 v 6.0
Android Y Y
Windows Mobile N N
webOS Y Y
bada Y N
MeeGo Y
12
13
14
15
<body>
<div data-role="page">
<div data-role="header"> <h1>Page Title</h1></div>
<div data-role="content"><p>Page content goes here.</p> </
div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
</body>
16
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Demo</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
</head>
17
Done on startup
18
<div data-role="content">
<p>Page content goes here.</p>
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
</body>
19
20
21
22
<div data-role="content">
<p>Page content goes here.</p>
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
23
<div data-role="content">
<p>Page content goes here.</p>
</div>
24
26
slide
slideup
slidedown
pop
fade
flip
27
28
29
30
Rest of local pages loaded via Ajax & added to current DOM
31
.portrait p {
color: red
}
.landscape p {
color: blue
}
32
.max-width-320px p {
color: red
}
33
34
<div data-role="page">
<div data-role="content">
<p>Try tap, tap hold or swipe</p>
</div>
</div>
35
data-transition="pop"
sets the transition
36
37
<div data-role="page">
<div data-role="content">
<a href="#dialog" data-rel="dialog" data-transition="pop">Open</a>
</div>
</div>
38
39
Positioning Options
in-line
Toolbar appears where put in HTML/CSS
fixed
Appears top and bottom of screen
After scrolling reappear at top and bottom
Tap hides/shows floating toolbar
fullscreen
Appears top and bottom of screen
Tap hides/shows toolbars
40
41
42
43
<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
</ul>
</div>
45
No Auto Generated
<div data-role="page" id="second">
<div data-role="header" data-backbtn="false">
<h1>Second Page</h1>
</div>
46
47
Up to 5 tabs
48
49