jquery mobile introduction ( demo on ezoapp )

48
jqmdesigner.appspot.com

Upload: ezoapp

Post on 27-Jan-2015

111 views

Category:

Technology


4 download

DESCRIPTION

This is a Presentation about jQueryMobile. http://www.slideshare.net/EZoApp/jquery-mobile-introduction-demo-on-ezoapp Sample description of each element has a corresponding, you can tap or drag structural elements observed in the sample code inside, and learning on WYSIWYG~ ^ _ ^ ( Demo on EZoApp, click the preview button and enjoy it~ )

TRANSCRIPT

Page 1: jQuery Mobile Introduction ( demo on EZoapp )

jqmdesigner.appspot.com

Page 2: jQuery Mobile Introduction ( demo on EZoapp )

What is jQuery Mobile?

Page 3: jQuery Mobile Introduction ( demo on EZoapp )

jQuery + Mobile

jQuery Mobile

=

Page 4: jQuery Mobile Introduction ( demo on EZoapp )

So simple, we all know it!

Page 5: jQuery Mobile Introduction ( demo on EZoapp )

But, What is jQuery Mobile? Can we eat it?

Page 6: jQuery Mobile Introduction ( demo on EZoapp )

Features

Powerful Ajax-powered navigation system

HTML5 Markup-driven configuration

Built on jQuery core

Responsive designProgressive enhancement

Touch and mouse event support

Lightweight size

Compatible with all major mobile, tablet, e-reader & desktop platforms

Unified UI widgets

Page 7: jQuery Mobile Introduction ( demo on EZoapp )

However, I heard that jQuery Mobile is fat

Page 8: jQuery Mobile Introduction ( demo on EZoapp )

jQuery Mobile Version 1.4.3Significantly improved performance than ever

Page 9: jQuery Mobile Introduction ( demo on EZoapp )

feel jQuery Mobile

http://demos.jquerymobile.com/1.4.2/

Page 10: jQuery Mobile Introduction ( demo on EZoapp )

Let’s Learn jQuery Mobile!

Let’s GO !

Page 11: jQuery Mobile Introduction ( demo on EZoapp )

<link rel="stylesheet" href="jquery.mobile.min.css" /> <script src="jquery.min.js"></script> <script src="jquery.mobile.min.js"></script>

jQuery Mobile preloaded program

Page 12: jQuery Mobile Introduction ( demo on EZoapp )

<head> <title>jQuery Mobile</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile.min.css" /> <script src="http://code.jquery.com/jquery-1.4.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.0a1/jquery.mobile.min.js"></script></head><body>

<div data-role="page"> <div data-role="header"> <h1>header</h1> </div>

<div class="ui-content"> <p>content</p> </div> <div data-role="footer"> <h4>footer</h4> </div></div> </body>

First step

Page 13: jQuery Mobile Introduction ( demo on EZoapp )

<div id="page1" data-role="page"><div role="main" class="ui-content"></div></div>

<div id="page2" data-role="page"><div role="main" class="ui-content"></div></div>

<div id="page3" data-role="page"><div role="main" class="ui-content"></div></div>

JQuery Mobile is usually a multiple pageHowever, only one of which is displayed, page id must be separated

page

Page 14: jQuery Mobile Introduction ( demo on EZoapp )

page Feel Page on EZoApp

http://goo.gl/EmXUY9

Page 15: jQuery Mobile Introduction ( demo on EZoapp )

★ Use <href>, switch directly to the specified "Page Id"★ Using "data-transition" set the transition effect★ Set data-rel = "back" to return with the same effect

pagetransition

<a href="#pageID" data-transition="效果 "></a>

★ You can also use javascript to do the switch★ $.mobile.changePage('#PageID');★ $.mobile.changePage('#PageB' , {'transition':'Effect'} );

Page 16: jQuery Mobile Introduction ( demo on EZoapp )

● default● fade● flip● flow● pop● slide● slidefade● slideup● slidedown● turn● none

<a href="#pageID" data-transition="effect"></a>

example:http://goo.gl/xwIR0F

pagetransition

Page 17: jQuery Mobile Introduction ( demo on EZoapp )

Button<a href="#" class="ui-btn">Anchor</a>

<button class="ui-btn">Button</button>

Use the "class" generate button style

<a href="#" class="ui-btn ui-btn-inline">Anchor</a><button class="ui-btn ui-btn-inline">Button</button>

Page 18: jQuery Mobile Introduction ( demo on EZoapp )

ButtonICON

<button class="ui-btn ui-btn-icon-left ui-icon-action">action</button><button class="ui-btn ui-btn-icon-left ui-icon-alert">alert</button><button class="ui-btn ui-btn-icon-up ui-icon-arrow-d">arrow-d</button><button class="ui-btn ui-btn-icon-right ui-icon-arrow-d-l">arrow-d-l</button><button class="ui-btn ui-btn-icon-bottom ui-icon-arrow-d-r">arrow-d-r</button><button class="ui-btn ui-btn-icon-left ui-icon-arrow-l">arrow-l</button>

example:http://goo.gl/TQxnvm

Use the "class" generate button style

Page 19: jQuery Mobile Introduction ( demo on EZoapp )

Grid<div class="ui-grid-b">

<div class="ui-block-a">Block A</div><div class="ui-block-b">Block B</div><div class="ui-block-c">Block C</div></div>

Use "class" generates Grid, you can put the Grid in Grid

ui-grid-a : 2 columns, ui-grid-b: 3 columnsui-grid-c: 4 columns, ui-grid-d: 5 columns

example:http://goo.gl/AizA2f

Page 20: jQuery Mobile Introduction ( demo on EZoapp )

Input <div class="ui-field-contain"> <label for="#text_id">Title</label> <input type="text" name="" id="#text_id"></div><div class="ui-field-contain"> <label for="#textarea_id">Title</label> <textarea name="" id="#textarea_id"></textarea></div><div class="ui-field-contain"> <label for="#search_id">Title</label> <input type="search" name="" id="#search_id"></div>

example:http://goo.gl/XOXJPH

Page 21: jQuery Mobile Introduction ( demo on EZoapp )

theme Use "class" have different themes按鈕:<a href="#" class="ui-btn ui-btn-a">Theme A</a><a href="#" class="ui-btn ui-btn-b">Theme B</a>navbar:<div data-role="navbar"> <ul> <li><a data-theme="a">Theme A</a></li> <li><a data-theme="b">Theme B</a></li> </ul></div>

example:http://goo.gl/E8QcW9

Page 22: jQuery Mobile Introduction ( demo on EZoapp )

Some examples of the above, we see that "class" is very important

Page 23: jQuery Mobile Introduction ( demo on EZoapp )

You must think

Page 24: jQuery Mobile Introduction ( demo on EZoapp )

Of course ! The second is also very important: data attribute

2

Page 25: jQuery Mobile Introduction ( demo on EZoapp )

What is data attribute?

Page 26: jQuery Mobile Introduction ( demo on EZoapp )

The data-* attributes is used to store custom data private to the page or application.The data-* attributes gives us the ability to embed custom data attributes on all HTML elements.

jQuery Mobile data attributehttp://api.jquerymobile.com/data-attribute/

Page 27: jQuery Mobile Introduction ( demo on EZoapp )

Header&

Footer

<div data-role="header" data-position="fixed"> <h1>header</h1></div>

<div data-role="footer" data-position="fixed"> <h4>footer</h4></div>

example: http://goo.gl/YpuDEY

Page 28: jQuery Mobile Introduction ( demo on EZoapp )

Navbar <div data-role="navbar"> <ul> <li><a href="#">One</a></li> <li><a href="#">Two</a></li> </ul></div>

example: http://goo.gl/3nwwe1

Page 29: jQuery Mobile Introduction ( demo on EZoapp )

Radiobutton

<form><fieldset data-role="controlgroup" data-type="horizontal"> <legend>Horizontal:</legend> <input type="radio" name="radio-choice-h-2" id="radio-choice-h-2a" value="on" checked="checked"> <label for="radio-choice-h-2a">One</label> <input type="radio" name="radio-choice-h-2" id="radio-choice-h-2b" value="off"> <label for="radio-choice-h-2b">Two</label> <input type="radio" name="radio-choice-h-2" id="radio-choice-h-2c" value="other"> <label for="radio-choice-h-2c">Three</label></fieldset></form>

example: http://goo.gl/Vh67Vf

Page 30: jQuery Mobile Introduction ( demo on EZoapp )

Checkbox

<form> <fieldset data-role="controlgroup"> <legend>Vertical:</legend> <input type="checkbox" name="checkbox-v-2a" id="checkbox-v-2a"> <label for="checkbox-v-2a">One</label> <input type="checkbox" name="checkbox-v-2b" id="checkbox-v-2b"> <label for="checkbox-v-2b">Two</label> <input type="checkbox" name="checkbox-v-2c" id="checkbox-v-2c"> <label for="checkbox-v-2c">Three</label> </fieldset></form>

example: http://goo.gl/x7vfGr

Page 31: jQuery Mobile Introduction ( demo on EZoapp )

Flip switch

<form> <label for="flip-2">Flip toggle switch:</label> <select name="flip-2" id="flip-2" data-role="flipswitch" data-theme="b"> <option value="off">Off</option> <option value="on">On</option> </select></form>

example: http://goo.gl/83Mn0z

Page 32: jQuery Mobile Introduction ( demo on EZoapp )

Listview<ul data-role="listview" data-inset="true" data-divider-theme="a"> <li data-role="list-divider">Mail</li> <li><a href="#">Inbox</a></li> <li><a href="#">Outbox</a></li> <li data-role="list-divider">Contacts</li> <li><a href="#">Friends</a></li> <li><a href="#">Work</a></li></ul>

Use "data-role" to easily create "listview (filter)"

example: http://goo.gl/XjmWug

Page 33: jQuery Mobile Introduction ( demo on EZoapp )

Popup <a href="#popupID" data-rel="popup" class="ui-btn"

data-transition="pop">Popup</a>

<div data-role="popup" id="popupID">

<p>popup 內容 </p>

</div>

example: http://goo.gl/7rcO1C

Page 34: jQuery Mobile Introduction ( demo on EZoapp )

Table<table data-role="table" id="table-column-toggle" data-mode="columntoggle" class="ui-responsive table-stroke"> <thead>

內容省略 </thead> <tbody> 內容省略 </tbody></table>

http://goo.gl/pMJlkP

(columntoggle / Reflow)

Page 35: jQuery Mobile Introduction ( demo on EZoapp )

SlidePanel

<div id="left-menu" data-role="panel" data-position="left">

left menu</div><div id="right-menu" data-role="panel" data-position="right"> right menu</div>

It is like App slider menu

example:http://goo.gl/jM6sU3

Page 36: jQuery Mobile Introduction ( demo on EZoapp )

How to make "jQuery Mobile" work?

How ?

Page 37: jQuery Mobile Introduction ( demo on EZoapp )

EventsPage

(function (){$(document).on( "pageinit" , "#pageID" ,

function(){// Page first loads will be executed

});})()

(function (){$(document).on( "pageshow" , "#pageID" ,

function(){// Will be executed after the page is displayed

});})()

http://goo.gl/0Zwgnd

Page 38: jQuery Mobile Introduction ( demo on EZoapp )

$('#id').on('tap', function () {});$('#id').on('taphold', function () {});$('#id').on('swipe', function () {});$('#id').on('swipeleft', function () {});$('#id').on('swiperight', function () {});

Five kinds of pages touch events

http://goo.gl/S5bJNq

EventsTouch

Page 39: jQuery Mobile Introduction ( demo on EZoapp )

$(window).on('orientationchange', function (event) {});

Detect rotation event for mobile devices

http://goo.gl/HnE1Fe

Eventsorientationchange

Page 40: jQuery Mobile Introduction ( demo on EZoapp )

After a series of presentations Everyone should understand a little jQuery Mobile

right?

? ? ? ? ?

Page 41: jQuery Mobile Introduction ( demo on EZoapp )

Let's look at some examples of jQuery Mobile

Page 42: jQuery Mobile Introduction ( demo on EZoapp )

Example 1 :Change font size

http://goo.gl/ov5WEf

Page 43: jQuery Mobile Introduction ( demo on EZoapp )

http://goo.gl/ppFIWB

Example 2 :Palette

Page 44: jQuery Mobile Introduction ( demo on EZoapp )

http://goo.gl/wiJ2BX

Example 3 :Ordering System

Page 45: jQuery Mobile Introduction ( demo on EZoapp )

Example 4 :EZoApp Map

http://goo.gl/UZp0Vb

Page 46: jQuery Mobile Introduction ( demo on EZoapp )

The above is a basic introduction to jQuery Mobile If you are interested, you can learn more on the official website

http://jquerymobile.com/

Page 47: jQuery Mobile Introduction ( demo on EZoapp )

Or use EZoApphttp://jqmdesigner.appspot.com/

Page 48: jQuery Mobile Introduction ( demo on EZoapp )

Thank you