Tutorial 4: jQuery Mobile

Slides:



Advertisements
Similar presentations
Chapter 3 – Web Design Tables & Page Layout
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
JQuery Mobile. Benefits Required links Remember that we need to add the links to the head, in this order.
Session 4 Chapter 15 - How to Use jQuery Mobile to Build and Mobile Web Site ITI 134: HTML5 Desktop and Mobile Level II
Cascading Style Sheets
INTRODUCTION TO HYPERTEXT MARKUP LANGUAGE 1. Outline  Introduction  Markup Languages  Editing HTML  Common Tags  Headers  Text Styling  Linking.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
Principles of Web Design 5 th Edition Chapter Nine Site Navigation.
Unit 20 - Client Side Customisation of Web Pages
JQUERY Mobile Overview Norman White. What is JQUERY Mobile? jQuery Mobile is a touch-friendly UI framework built on jQuery Core that works across all.
CNIT 132 Intermediate HTML and CSS jQuery Mobile.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
TUTORIAL 8: Enhancing a Web Site with Advanced CSS
 jQuery Mobile An Introduction. What is jQuery Mobile  A framework built on top of jQuery, used for creating mobile web applications  Designed to make.
JQUERY – UI & THEMES "WRITE LESS, DO MORE" Built in interface elements.
CS 174: Web Programming April 9 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Anatomy of an App HTML, CSS, jQuery, jQuery Mobile CIS 136 Building Mobile Apps 1.
Tutorial 6 Creating Tables and CSS Layouts. Objectives Session 6.1 – Create a data table to display and organize data – Modify table properties and layout.
Chapter 3 Working with Text and Cascading Style Sheets.
Chapter 2 Developing a Web Page. Chapter 2 Lessons Introduction 1.Create head content and set page properties 2.Create, import, and format text 3.Add.
Chapter 2 Developing a Web Page. A web page is composed of two distinct sections: –The head content –The body Creating Head Content and Setting Page Properties.
Dr. Nuha El-KhaliliInternet Programming ( ) HTML Hyper Text Markup Language The language of web pages Maintained by the W3C
Website Development with Dreamweaver
Chapter 2 HTML Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
IDs versus Classes Naming Your Tags for Maximum Functionality.
XP Dreamweaver 8.0 Tutorial 3 1 Adding Text and Formatting Text with CSS Styles.
 Word doc for you to download › Link at the beginning of class › 10 Questions › Answers to be added inline  Post to Sakai when completed › No resubmits.
 Remember that HTML is just text  Need to point to pictures  Use the img tag  alt: › screen reader › REQUIRED for this class and to validate.
Copyright 2007, Information Builders. Slide 1 Understanding Basic HTML Amanda Regan Technical Director June, 2008.
Adobe Dreamweaver CS3 Revealed CHAPTER THREE: WORKING WITH TEXT AND IMAGES.
>> HTML: Structure Elements. Elements in HTML are either Inline or Block. Block-level Elements – Begins on a new line – Occupy the whole width – Stacks.
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
Macromedia Dreamweaver 8 Revealed WEB PAGE DEVELOPING A.
Positioning Objects with CSS and Tables
An Introduction to JQuery Mobile By Trevor Seeney.
Chapter 3 CSS Components Yeunyong Kantanet School of Information and Communication Technology University of Phayao Yeunyong Kantanet School of Information.
Header, Footer, and Navigation toolbars CIS 136 Building Mobile Apps 1.
Multiple Page Apps CIS 136 Building Mobile Apps 1.
CSS.
Cascading Style Sheets (CSS) Internal Style Sheets Classes
Web Development & Design Foundations with HTML5
CSCI 1720 W3.CSS – Part 1 East Tennessee State University Department of Computing CSCI 1720 Intermediate Web Design.
HTML5 Level II Session IV
CSS Layouts: Positioning and Navbars
CSS Layouts: Grouping Elements
12/04/12 JQuery I took these slides from the site because they were pretty good looking. Instructions for editing school and department titles: Select.
Front-End Framework for Responsive Web Sites
With Microsoft FrontPage 2000
Web Development & Design Foundations with HTML5 8th Edition
Chapter A - Getting Started with Dreamweaver MX 2004
JQuery UI.
Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu
Web Development & Design Foundations with HTML5
Buttons, Headers, Footers, and Navigation
CIS 136 Building Mobile Apps
Bootstrap Topics What is bootstrap? Documentation
Fixed Positioning.
Popups, Dialogs, Widgets, Panels
Cascade Style Sheet Demo W3Schools. com: w3schools
Anatomy of an App User Interface Design
DHTML tidbits.
SEEM4570 Tutorial 5: jQuery + jQuery Mobile
Buttons, Headers, Footers, and Navigation
Multipage Sites.
Web Development & Design Foundations with HTML5
5.00 Apply procedures to organize content by using Dreamweaver. (22%)
Cascade Style Sheet Demo W3Schools. com: w3schools
CSS: Classes and Contextual Selectors
Presentation transcript:

Tutorial 4: jQuery Mobile XU Yinqing Email: yqxu@se.cuhk.edu.hk Department of Systems Engineering and Engineering Management

Outline What is jQuery Mobile? Install Pages Transistions Buttons Toolbars Open Panel Collapsibles jQuery Mobile Themes 2018/9/18 SEEM 4570 Tutorial Notes

What is jQuery Mobile? jQuery Mobile is a framework for creating mobile web applications. Framework is a set of ready-to-use functions and objects, so that we do not need to write everything by ourselves jQuery Mobile works on all popular smartphones and tablets. jQuery Mobile uses HTML5 & CSS3 for laying out pages with minimal scripting. 2018/9/18 SEEM 4570 Tutorial Notes

Install – Method I Include jQuery Mobile from a CDN(Content Distribution Network) <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.css"> <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <script src="http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.js"></script> </head> 2018/9/18 SEEM 4570 Tutorial Notes

Install – Method II Download the jQuery Mobile library from jQuerymobile.com Place the downloaded files in the same directory as the pages where you wish to use it. <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="jquery.mobile-1.4.1.css"> <script src="jquery.js"></script> <script src="jquery.mobile-1.4.1.js"></script> </head> 2018/9/18 SEEM 4570 Tutorial Notes

Pages A simple, standard jQuery Mobile page <body> <div data-role="page"> <div data-role="header"> <h1>Welcome To My Homepage</h1> </div> <div data-role="main" class="ui-content"> <p>I Am Now A Mobile Developer!!</p> <div data-role="footer"> <h1>Footer Text</h1> </body> 2018/9/18 SEEM 4570 Tutorial Notes

Multiple pages  <div data-role="page" id="pageone"> <div data-role="main" class="ui-content"> <a href="#pagetwo">Go to Page Two</a> </div> <div data-role="page" id="pagetwo"> <a href="#pageone">Go to Page One</a> 2018/9/18 SEEM 4570 Tutorial Notes

Using Pages as Dialogs A dialog box is a type of window used to show special information or request input. (demo) <div data-role="page" id="pageone"> <div data-role="main" class="ui-content"> <a href="#pagetwo">Go to Page Two</a> </div> <div data-role="page" data-dialog="true" id="pagetwo"> <a href="#pageone">Go to Page One</a> 2018/9/18 SEEM 4570 Tutorial Notes

Transistions jQuery Mobile has a variety of effects for how to transition from one page to the next. The transition effects can be applied to any link or form submission by using the data-transition attribute: <a href="#anylink" data-transition="slide">Slide to Page Two</a> Reverse/backward actions of effects: <a href="#pagetwo" data-transition="slide" data-direction="reverse">Slide</a> 2018/9/18 SEEM 4570 Tutorial Notes

Transition effects Transition Description fade Default. Fades to the next page flip Flips to the next page from back to front flow Throws the current page away and comes in with the next page pop Goes to the next page like a popup window slide Slides to the next page from right to left slidefade Slides from right to left and fades in the next page slideup Slides to the next page from bottom to top slidedown Slides to the next page from top to bottom turn Turns to the next page none No transition effect 2018/9/18 SEEM 4570 Tutorial Notes

Buttons A button in jQuery Mobile can be created in three ways: Using the <input> element <input type="button" value="Button"> Using the <button> element with class="ui-btn" <button class="ui-btn">Button</button> Using the <a> element with class="ui-btn" <a href="#" class="ui-btn">Button</a> <a> element with class="ui-btn" to link between pages, and <input> or <button> elements for form submission. 2018/9/18 SEEM 4570 Tutorial Notes

Buttons (cont’d) Navigation Buttons Grouped Buttons To link between pages by buttons, use the <a> element with class="ui-btn" Grouped Buttons Use the data-role="controlgroup" attribute together with data-type="horizontal/vertical" in a container element: <div data-role="controlgroup" data-type="horizontal"> <a href="#" class="ui-btn">Button 1</a> <a href="#" class="ui-btn">Button 2</a> <a href="#" class="ui-btn">Button 3</a> </div> 2018/9/18 SEEM 4570 Tutorial Notes

Buttons (cont’d) Back Buttons Inline Buttons Use the data-rel="back" attribute (this will ignore the anchor's href value): <a href="#" class="ui-btn" data-rel="back">Go Back</a> Inline Buttons Add the "ui-btn-inline" class to make the botton as wide as its content <a href="#pagetwo" class="ui-btn ui-btn-inline">Go to Page Two</a> 2018/9/18 SEEM 4570 Tutorial Notes

Toolbars Toolbar elements are often placed inside headers and footers - for "easy-access" navigation The header is located at the top of the page and usually contain a page title/logo or one or two buttons (typically home, options or search). The footer is located at the bottom of the page and can contain as many buttons as needed. 2018/9/18 SEEM 4570 Tutorial Notes

Toolbars - Header Bars Two buttons: Only left button: <div data-role="header"> <a href="#" class="ui-btn ui-icon-home ui-btn-icon-left">Home</a> <h1>Welcome To My Homepage</h1> <a href="#" class="ui-btn ui-icon-search ui-btn-icon-left">Search</a> </div> Only left button: <a href="#" class="ui-btn ui-btn-left ui-icon-home ui-btn-icon-left">Home</a> Only right button: <a href="#" class="ui-btn ui-btn-right ui-icon-home ui-btn-icon-left">Search</a> 2018/9/18 SEEM 4570 Tutorial Notes

Toolbars - Footer Bars Center the buttons: Group buttons: <div data-role="footer" style="text-align:center;"> Group buttons: <div data-role="controlgroup" data-type="horizontal"> <a href="#" class="ui-btn ui-icon-plus ui-btn-icon-left">Add Me On Facebook</a> <a href="#" class="ui-btn ui-icon-plus ui-btn-icon-left">Add Me On Twitter</a> <a href="#" class="ui-btn ui-icon-plus ui-btn-icon-left">Add Me On Instagram</a> </div> 2018/9/18 SEEM 4570 Tutorial Notes

Panel Panels in jQuery Mobile will slide out from the left or the right side of the screen with additional content. (demo) 2018/9/18 SEEM 4570 Tutorial Notes

Open Panel To create a panel, add the data-role="panel" attribute to a <div> element and specify an id. <div data-role="panel" id="myPanel"> <h2>Panel Header..</h2> <p>Some text..</p> </div> To access the panel, create a link that points to the id of the panel <div>. <a href="#myPanel" class="ui-btn ui-btn-inline">Open Panel</a> 2018/9/18 SEEM 4570 Tutorial Notes

Collapsibles Collapsibles allow you to hide or show content. To create a collapsible block of content, assign the data-role="collapsible" attribute to a container.  <div data-role="collapsible"> <h1>Click me - I'm collapsible!</h1> <p>I'm the expanded content.</p> </div> By default, the content is closed. To expand the content when the page loads, use data-collapsed ="false" 2018/9/18 SEEM 4570 Tutorial Notes

Nested Collapsible Blocks Demo: <div data-role="collapsible"> <h1>Click me - I'm collapsible!</h1> <p>I'm the expanded content.</p> <h1>Click me - I'm a nested collapsible block!</h1> <p>I'm the expanded content in the nested collapsible block.</p> </div> 2018/9/18 SEEM 4570 Tutorial Notes

Collapsible Sets Create several collapsible content blocks, and then wrap a new container with the data-role = "collapsibleset" around the collapsible blocks (demo) <div data-role="collapsibleset"> <div data-role="collapsible"> <h1>Click me - I'm collapsible!</h1> <p>I'm the expanded content.</p> </div> 2018/9/18 SEEM 4570 Tutorial Notes

jQuery Mobile Themes jQuery Mobile provides two different style themes, "a" and "b" - each with different colors for buttons, bars, content blocks, and so on. 2018/9/18 SEEM 4570 Tutorial Notes

jQuery Mobile Themes (cont’d) Use the data-theme attribute to customize the look of the application: <div data-role="page" data-theme="a/b"> For buttons with class="ui-btn", use the "ui-btn-a/b" class to style the button either gray (default) or black: <a href="#" class="ui-btn ui-btn-a/b">Button</a> 2018/9/18 SEEM 4570 Tutorial Notes

Add New Themes Add or edit new themes by editing the CSS file. Just copy a block of styles and rename the classes with a letter name (c-z), and adjust colors and fonts as you like. Add new styles by using theme classes in the HTML document add the class "ui-bar-(a-z)" for toolbars, "ui-body-(a-z)" for the content and ui-page-theme-(a-z)" for the page 2018/9/18 SEEM 4570 Tutorial Notes

Add New Themes (cont’d) <style> .ui-bar-f { color:red; background-color:yellow; } .ui-body-f font-weight:bold; color:white; background-color:purple; .ui-page-theme-f background-color:green; </style> 2018/9/18 SEEM 4570 Tutorial Notes

Thank you.