introduction to jquery mobile - web deliver for all

97
Web Delivery for ALL!

Upload: marc-grabanski

Post on 15-Jul-2015

27.116 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Introduction to jQuery Mobile - Web Deliver for All

Web Delivery for ALL!

Page 2: Introduction to jQuery Mobile - Web Deliver for All

!!

jQuery UI Datepicker !

MarcGrabanski.com !

LOTS of UI Dev

Who?Marc Grabanski

Page 3: Introduction to jQuery Mobile - Web Deliver for All

!!!

Publisher of:

Currently...UI/UX Development Consultant

http://FrontendMasters.com

Page 4: Introduction to jQuery Mobile - Web Deliver for All

The web is for everyone and all can view it

The Great Promise of the Web

Page 5: Introduction to jQuery Mobile - Web Deliver for All
Page 6: Introduction to jQuery Mobile - Web Deliver for All

Not “Mobile Only” Mobile First

Page 7: Introduction to jQuery Mobile - Web Deliver for All

Desktop too!

Page 8: Introduction to jQuery Mobile - Web Deliver for All

Source Your Sources

Page 9: Introduction to jQuery Mobile - Web Deliver for All

I visited

and talked to

about

Page 10: Introduction to jQuery Mobile - Web Deliver for All

Why jQuery Mobile?

Page 11: Introduction to jQuery Mobile - Web Deliver for All

4 Main Reasons to Use jQuery Mobile

Page 12: Introduction to jQuery Mobile - Web Deliver for All

#1. Ajaxified Navigation

Friendly Ajax URLs

Faster subsequent page loads

Page 13: Introduction to jQuery Mobile - Web Deliver for All

#2. Layout and Theming Engine

Quickly style and extend styles

Page 14: Introduction to jQuery Mobile - Web Deliver for All

#3 Touch Friendly Inputs

(and widgets)Improved UX for form inputs

Page 15: Introduction to jQuery Mobile - Web Deliver for All

#4 Widest Browser Coverage

Web living up to it’s promise

Page 16: Introduction to jQuery Mobile - Web Deliver for All

Devices TestedjQuery Mobile Testing Lab

Page 17: Introduction to jQuery Mobile - Web Deliver for All

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

Page 18: Introduction to jQuery Mobile - Web Deliver for All

Progressive Enhancement

C-Grade: Basic HTML

B-Grade: Enhanced Style, No Ajax

A-Grade: Full Enhanced Style,

Ajax and CSS Transitions

+++

Page 19: Introduction to jQuery Mobile - Web Deliver for All

You’ll always see...something

Page 20: Introduction to jQuery Mobile - Web Deliver for All

it’s alive!

Page 21: Introduction to jQuery Mobile - Web Deliver for All

Galleryhttp://jqmgallery.com

Page 22: Introduction to jQuery Mobile - Web Deliver for All

and growing...

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

Page 23: Introduction to jQuery Mobile - Web Deliver for All

Two popular mobile frameworks

“App First”

http://www.google.com/trends/?q=jquery+mobile,+sencha,+dojo+mobile,+jqmobi

“Web First”

Page 24: Introduction to jQuery Mobile - Web Deliver for All

jQuery Mobile + Adobe

Embedded into Creative Suite Sponsors jQuery Mobile Dev

Page 25: Introduction to jQuery Mobile - Web Deliver for All

Dev Snapshothttp://jquerymobile.com/test

Page 26: Introduction to jQuery Mobile - Web Deliver for All

One More *Magical* File

Page 27: Introduction to jQuery Mobile - Web Deliver for All

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/

Page 28: Introduction to jQuery Mobile - Web Deliver for All

#1 - Ajaxified Navigation

Page 29: Introduction to jQuery Mobile - Web Deliver for All

No page refresh?! How does that work?

Page 30: Introduction to jQuery Mobile - Web Deliver for All

Looks for href and action in your HTML

Page 31: Introduction to jQuery Mobile - Web Deliver for All

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)

Page 32: Introduction to jQuery Mobile - Web Deliver for All

/index.html

*click*

Page 33: Introduction to jQuery Mobile - Web Deliver for All

/index.html /page.html

*load*

Page 34: Introduction to jQuery Mobile - Web Deliver for All

/index.html /page.html

*slide*

Page 35: Introduction to jQuery Mobile - Web Deliver for All

/index.html /page.html

*done*

Page 36: Introduction to jQuery Mobile - Web Deliver for All

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/page-transitions.html

Page 37: Introduction to jQuery Mobile - Web Deliver for All

Default transition is now fade

(more webby)

Page 38: Introduction to jQuery Mobile - Web Deliver for All

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/multipage-template.html

Page 39: Introduction to jQuery Mobile - Web Deliver for All

No more #/crap/urls.html

Pushstate on Relative URLs/index.html

to /index.html#/foo.html

to /foo.html

Page 40: Introduction to jQuery Mobile - Web Deliver for All

1. Form action=”page.html” POST Ajax

2. Slides in New Content

3. Updates URL(same as links)

Auto-Ajax Forms

Page 41: Introduction to jQuery Mobile - Web Deliver for All

I don’t use auto-ajax forms. Disable with

data-ajax=false

Page 42: Introduction to jQuery Mobile - Web Deliver for All

#2 - Layout and Theming

Page 43: Introduction to jQuery Mobile - Web Deliver for All

Looking for data-* attributes

Page 44: Introduction to jQuery Mobile - Web Deliver for All

Play a Role

data-role=*

page, header, content, footer, listview, list-divider, button, controlgroup

Page 45: Introduction to jQuery Mobile - Web Deliver for All

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

Page 46: Introduction to jQuery Mobile - Web Deliver for All

Markup

Magical

Zones

<div data-role=header>...</div>

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

<div data-role=footer>...</div>

Page 47: Introduction to jQuery Mobile - Web Deliver for All

Docs Structure

<div data-role=content>

<div data-role=footer>

<div data-role=page>

Page 48: Introduction to jQuery Mobile - Web Deliver for All

Listview

Page 49: Introduction to jQuery Mobile - Web Deliver for All

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>

Page 50: Introduction to jQuery Mobile - Web Deliver for All

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

Page 51: Introduction to jQuery Mobile - Web Deliver for All

List Theming

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

http://jquerymobile.com/demos/1.2.0/docs/api/themes.html

Page 52: Introduction to jQuery Mobile - Web Deliver for All

List Theming

<ul data-theme=b> <li>...</li> <li>...</li> </ul>

Page 53: Introduction to jQuery Mobile - Web Deliver for All

Content Themingui-[body|bar]-[a-f]

class=”ui-body ui-body-b”

class=”ui-bar ui-bar-c”

Page 54: Introduction to jQuery Mobile - Web Deliver for All

e.g. Docs Theming

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

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

Page 55: Introduction to jQuery Mobile - Web Deliver for All

Responsive Docs Example

class=content-primary

class=content-secondary

MobileTablet and Desktop

Page 56: Introduction to jQuery Mobile - Web Deliver for All

jQuery Mobile ThemeRoller

http://jquerymobile.com/themeroller/index.php

Page 57: Introduction to jQuery Mobile - Web Deliver for All

Reusable Widgets

Page 58: Introduction to jQuery Mobile - Web Deliver for All

Buttons

Link as a button

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

http://jquerymobile.com/demos/1.2.0/docs/buttons/buttons-types.html

Page 59: Introduction to jQuery Mobile - Web Deliver for All

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

Page 60: Introduction to jQuery Mobile - Web Deliver for All

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

Page 61: Introduction to jQuery Mobile - Web Deliver for All

Dialog

<a data-rel=dialog>

http://jquerymobile.com/demos/1.2.0/docs/pages/page-dialogs.html

Page 62: Introduction to jQuery Mobile - Web Deliver for All

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

Page 63: Introduction to jQuery Mobile - Web Deliver for All

Navbardata-role=navbar

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

Page 64: Introduction to jQuery Mobile - Web Deliver for All

Navbar w/Icons

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

Page 65: Introduction to jQuery Mobile - Web Deliver for All

Filter Bar

<ul data-filter=true>

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

Page 66: Introduction to jQuery Mobile - Web Deliver for All

http://jquerymobile.com/demos/1.2.0/docs/pages/popup/index.html

Popup Widget

Page 67: Introduction to jQuery Mobile - Web Deliver for All

#3 Touch-friendly Form Inputs

Page 68: Introduction to jQuery Mobile - Web Deliver for All

Enhance Form Elements

Default MOBILIZED!

Page 69: Introduction to jQuery Mobile - Web Deliver for All
Page 70: 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/

Page 71: Introduction to jQuery Mobile - Web Deliver for All

Search Input

<input type=search>

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

Page 72: Introduction to jQuery Mobile - Web Deliver for All

Checkbox Set

http://jquerymobile.com/demos/1.2.0/docs/forms/checkboxes/

Page 73: Introduction to jQuery Mobile - Web Deliver for All

Radio Button Set

http://jquerymobile.com/demos/1.2.0/docs/forms/radiobuttons/

Page 74: Introduction to jQuery Mobile - Web Deliver for All

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/

Page 75: Introduction to jQuery Mobile - Web Deliver for All

data-native-menu=true

Page 76: Introduction to jQuery Mobile - Web Deliver for All

data-native-menu=false

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

Page 77: Introduction to jQuery Mobile - Web Deliver for All

Auto Grow Textareas

http://jquerymobile.com/demos/1.2.0/docs/forms/textinputs/index.html

Page 78: Introduction to jQuery Mobile - Web Deliver for All

HTML5 Input Types (not just jQuery Mobile)

Page 79: Introduction to jQuery Mobile - Web Deliver for All

<input type=password>

Page 80: Introduction to jQuery Mobile - Web Deliver for All

<input type=number>

Page 81: Introduction to jQuery Mobile - Web Deliver for All

<input type=email>

Page 82: Introduction to jQuery Mobile - Web Deliver for All

<input type=url>

Page 83: Introduction to jQuery Mobile - Web Deliver for All

<input type=tel>

Page 84: Introduction to jQuery Mobile - Web Deliver for All

Misc Notes

Page 85: Introduction to jQuery Mobile - Web Deliver for All

Widgets• page sections

• checkboxradio

• select

• slider

• textinput

• links

• collapsible

• popup

• controlgroup

• fieldcontain

• fixheaderfooter

• button

• listview

• navbar

• grid

• dialog

Page 86: Introduction to jQuery Mobile - Web Deliver for All

Download Builder

http://jquerymobile.com/download-builder/

Page 87: Introduction to jQuery Mobile - Web Deliver for All

SnippetsConfigure jQM

$(document).on("mobileinit", function(){

$.extend($.mobile , { foo: bar });

});

New DOM Ready

$(document).on(“pagecreate”, function(e) {

// do somefin’ will ya?

});

Page 88: Introduction to jQuery Mobile - Web Deliver for All

Modifying DOM$page .append(“<a data-role=button>Button</a>”) .trigger(‘create’)

Initializes UI components

Page 89: Introduction to jQuery Mobile - Web Deliver for All

Viewport Tag

Not auto-injected.

<meta name="viewport" content="width=device-width, initial-scale=1">

Page 90: Introduction to jQuery Mobile - Web Deliver for All

No JavaScript Scroll

Native overflow support

-webkit-overflow-scrolling: touch;

No JavaScript “fake scrolling”

Still problems with it

Page 91: Introduction to jQuery Mobile - Web Deliver for All

CSS Transitions

• New transitions turn and flow as of 1.1

• Flip on Android is Stupid (does a cartwheel)

Page 92: Introduction to jQuery Mobile - Web Deliver for All

Plugins and Resources

http://jquerymobile.com/resources/

Page 93: Introduction to jQuery Mobile - Web Deliver for All

jQuery Mobile Router

https://github.com/azicchetti/jquerymobile-router

var approuter = new $.mobile.Router([

{ "#certainPage": { handler: "foo", events: "s" } },

{ "#certainPage": { handler: "bar", events: "h" } }

], {

foo: function(...){...},

bar: function(...){...}

}, options);

Page 94: Introduction to jQuery Mobile - Web Deliver for All

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

$.mobile.routerlite.routeinit("/admin", function(page, path){

doSomething();

});

$.mobile.routerlite.routechange("/admin", function(page, path){

doSomething();

});

jQuery Mobile Router Lite

Page 95: Introduction to jQuery Mobile - Web Deliver for All

iOS Theme

http://taitems.tumblr.com/post/7240874402/ios-inspired-jquery-mobile-theme-jquery-mobile

Page 96: Introduction to jQuery Mobile - Web Deliver for All

Thanks!

Page 97: Introduction to jQuery Mobile - Web Deliver for All

Marc Grabanski @1marc