SlideShare a Scribd company logo
Web Delivery for ALL!
Who?
Marc Grabanski
!
!

jQuery UI Datepicker
!

MarcGrabanski.com
!

LOTS of UI Dev
Currently...
UI/UX Development Consultant
!
!
!

Publisher of:

http://FrontendMasters.com
The Great Promise
of the Web

The web is for everyone
and all can view it
Introduction to jQuery Mobile - Web Deliver for All
Not “Mobile Only”
Mobile First
Desktop too!
Source
Your Sources
I visited

and talked to

about
Why jQuery
Mobile?
4 Main Reasons to
Use jQuery Mobile
#1. Ajaxified
Navigation
Faster subsequent page loads

Friendly Ajax URLs
#2. Layout and
Theming Engine
Quickly style and extend styles
#3
Touch Friendly Inputs
(and widgets)
Improved UX for form inputs
#4
Widest Browser Coverage

Web living up to it’s promise
Devices Tested
jQuery Mobile Testing Lab
Fully Supported
•
•
•
•
•
•
•

iOs 3.2+, Android 2.1+/Honeycomb
Windows Phone 7
Blackberry 6.0/Playbook
Palm WebOS 1.4+
Mobile Opera & Mobile Firefox
Amazon Kindle 3 & Fire
Desktop Chrome, FF, IE 7+, Opera
Progressive
Enhancement
C-Grade: Basic HTML

+
++

B-Grade: Enhanced Style, No Ajax
A-Grade: Full Enhanced Style,
Ajax and CSS Transitions
You’ll always
see...something
it’s alive!
Gallery
http://jqmgallery.com
and growing...

http://www.google.com/trends/?q=jquery+mobile
Two popular mobile frameworks

“Web First”

“App First”

http://www.google.com/trends/?q=jquery+mobile,+sencha,+dojo
+mobile,+jqmobi
jQuery Mobile
+ Adobe
Embedded into Creative Suite
Sponsors jQuery Mobile Dev
Dev Snapshot
http://jquerymobile.com/test
One More
*Magical* File
Get the
(Coding)Party
Including Latest:
!

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/
jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/
jquery.mobile-1.2.0.min.js"></script>

http://jquerymobile.com/download/
#1 - Ajaxified
Navigation
No page refresh?!
How does that work?
Looks for
href and action
in your HTML
Auto-Ajax
Links
1. Ajax gets href=”page.html” 

(unless data-ajax=false)
2. Slides in New Content
3. Updates URL

(with <body>...</body> 

or data-role=page)
/index.html

*click*
/index.html

/page.html

*load*
/index.html

/page.html

*slide*
ndex.html

/page.html

*done*
Page Transitions
•

<a data-transition=pop>...</a>

(slide, slideup, slidedown, pop,
fade, flip)
!

•

<a data-transition=pop 

data-direction=reverse>...</a>

http://jquerymobile.com/demos/1.2.0/docs/pages/pagetransitions.html
Default transition
is now fade
(more webby)
Pages w/out Ajax
<div data-roll=page 

id=page1>...</div>
<div data-roll=page

id=page2>...</div>
!

<a href=”#page1”>Page 1</a>
<a href=”#page2”>Page 2</a>
http://jquerymobile.com/demos/1.2.0/docs/pages/multipagetemplate.html
No more
#/crap/urls.html
Pushstate on Relative URLs




/index.html
to /index.html#/foo.html
to /foo.html
Auto-Ajax
Forms
1. Form action=”page.html”
POST Ajax
2. Slides in New Content
3. Updates URL

(same as links)

I don’t use auto-ajax
forms. Disable with
data-ajax=false
#2 - Layout and
Theming
Looking for
data-* attributes
Play a Role
data-role=*
page, header, content, footer,
listview, list-divider, button,
controlgroup
Structure
!

<div data-role="page">
<div data-role="header">...</div>
<div data-role="content">...</div>
<div data-role="footer">...</div>
</div>

http://jquerymobile.com/demos/1.2.0/docs/pages/page-anatomy.html
Magical
<div data-role=header>...</div>

Markup
<div data-role=content>...</div>

Zones
<div data-role=footer>...</div>
Docs Structure
<div data-role=page>
<div data-role=content>

<div data-role=footer>
Listview
Listview
<ul data-role=listview ...>
<li data-role=list-divider>...</li>
<li><a href=”...”></a></li>
<li><a href=”...”></a></li>
<li><a href=”...”></a></li>
<li><a href=”...”></a></li>
<li><a href=”...”></a></li>
...
</ul>
data-* Theme
Attributes
• data-theme=[a-f]
• data-[element]theme=[a-f]
• <ul data-dividertheme=[a-f]>
• <ul data-inset=true>
http://jquerymobile.com/demos/1.2.0/docs/api/themes.html
List Theming

<ul data-theme=[a-f]>

http://jquerymobile.com/demos/1.2.0/docs/api/themes.html
List Theming
<ul data-theme=b>
<li>...</li>
<li>...</li>
</ul>
Content Theming
ui-[body|bar]-[a-f]
class=”ui-bar ui-bar-c”

class=”ui-body ui-body-b”
e.g. Docs Theming

<ul data-inset=true
data-dividertheme=b ...>

<ul data-inset=true
data-dividertheme=f ...>
Responsive Docs Example
Tablet and Desktop
Mobile

class=content-primary

class=content-secondary
jQuery Mobile
ThemeRoller

http://jquerymobile.com/themeroller/index.php
Reusable
Widgets
Buttons

Link as a button
<a data-role=button ...>slidedown</a>

http://jquerymobile.com/demos/1.2.0/docs/buttons/buttonstypes.html
data-* Button
Theming
<button data-icon=*>

arrow-r, delete, plus, minus, gear,
grid, refresh, etc.

http://jquerymobile.com/demos/1.2.0/docs/buttons/
buttons-icons.html
data-* Button
Theming
<button data-inline=true>
<button data-icon=delete

data-iconpos=right>

http://jquerymobile.com/demos/1.2.0/docs/buttons/
buttons-icons.html
Dialog
<a data-rel=dialog>

http://jquerymobile.com/demos/1.2.0/docs/pages/page-dialogs.html
Control Group
<div data-role=controlgroup

data-type=horizontal>
<a data-role=button>Yes</a>
<a data-role=button>No</a>
<a data-role=button>Maybe</a>
</div>
http://jquerymobile.com/demos/1.2.0/docs/buttons/
buttons-grouped.html
Navbar
data-role=navbar

http://jquerymobile.com/demos/1.2.0/docs/toolbars/docs-navbar.html
Navbar w/Icons

http://jquerymobile.com/demos/1.2.0/docs/toolbars/
docs-navbar.html
Filter Bar

<ul data-filter=true>

http://jquerymobile.com/demos/1.2.0/docs/lists/lists-search.html
Popup Widget

http://jquerymobile.com/demos/1.2.0/docs/pages/popup/index.html
#3
Touch-friendly
Form Inputs
Enhance Form
Elements
Default

MOBILIZED!
Introduction to jQuery Mobile - Web Deliver for All
Slider
<input type=range 

value=50 min=0 max=100>

http://jquerymobile.com/demos/1.2.0/docs/forms/slider/
Search Input
<input type=search>

http://jquerymobile.com/demos/1.2.0/docs/forms/search/
Checkbox Set

http://jquerymobile.com/demos/1.2.0/docs/forms/checkboxes/
Radio Button Set

http://jquerymobile.com/demos/1.2.0/docs/forms/radiobuttons/
Flip Switch
<select data-roll=slider>
<option>Switch Off</option>
<option>Switch On</option>
</select>

http://jquerymobile.com/demos/1.2.0/docs/forms/switch/
data-native-menu=true
data-native-menu=false

http://jquerymobile.com/demos/1.2.0/docs/forms/selects/custom.html
Auto Grow Textareas

http://jquerymobile.com/demos/1.2.0/docs/forms/textinputs/
index.html
HTML5 Input Types
(not just jQuery Mobile)
<input type=password>
<input type=number>
<input type=email>
<input type=url>
<input type=tel>
Misc Notes
Widgets
•
•
•
•
•
•
•
•

page sections
checkboxradio
select
slider
textinput
links
collapsible
popup

•
•
•
•
•
•
•
•

controlgroup
fieldcontain
fixheaderfooter
button
listview
navbar
grid
dialog
Download Builder

http://jquerymobile.com/download-builder/
Snippets
Configure jQM
$(document).on("mobileinit", function(){
$.extend($.mobile , { foo: bar });
});
New DOM Ready
$(document).on(“pagecreate”, function(e) {
// do somefin’ will ya?
});
Modifying DOM
$page

.append(“<a data-role=button>Button</a>”)

.trigger(‘create’)
Initializes UI components
Viewport Tag
Not auto-injected.
<meta name="viewport"
content="width=device-width,
initial-scale=1">
No JavaScript
Scroll
Native overflow support
-webkit-overflow-scrolling: touch;
No JavaScript “fake scrolling”
Still problems with it
CSS Transitions
•

New transitions turn and flow 

as of 1.1

•

Flip on Android is Stupid

(does a cartwheel)
Plugins and
Resources

http://jquerymobile.com/resources/
jQuery Mobile Router
var approuter = new $.mobile.Router([
{ "#certainPage": { handler: "foo", events: "s" } },
{ "#certainPage": { handler: "bar", events: "h" } }
], {
foo: function(...){...},
bar: function(...){...}
}, options);

https://github.com/azicchetti/jquerymobile-router
jQuery Mobile
Router Lite
$.mobile.routerlite.routeinit("/admin",
function(page, path){
doSomething();
});
$.mobile.routerlite.routechange("/admin",
function(page, path){
doSomething();
});

https://github.com/1Marc/jquery-mobile-routerlite
iOS Theme

http://taitems.tumblr.com/post/7240874402/ios-inspired-jquerymobile-theme-jquery-mobile
Thanks!
Marc Grabanski
@1marc

More Related Content

Introduction to jQuery Mobile - Web Deliver for All