Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu

Slides:



Advertisements
Similar presentations
Support.ebsco.com EBSCOhost Mobile Tutorial. Welcome to the EBSCOhost Mobile tutorial, a guide to the most popular EBSCOhost features available for use.
Advertisements

Chapter 3 – Web Design Tables & Page Layout
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?
What is jQuery Mobile? How to use it? Doncho Minkov Telerik Corporation Technical Trainer.
JQuery Mobile. Benefits Required links Remember that we need to add the links to the head, in this order.
MIS 425 Lecture 2 – HTML Navigation, Colors, tables and Styles Instructor: Martin Neuhard
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Principles of Web Design 5 th Edition Chapter Nine Site Navigation.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
CNIT 132 Intermediate HTML and CSS jQuery Mobile.
Chapter 1 Getting Started With Dreamweaver. Explore the Dreamweaver Workspace The Dreamweaver workspace is where you can find all the tools to create.
CS428 Web Engineering Lecture 15 Introduction to Jquery.
Creating Web Page Forms
 jQuery Mobile An Introduction. What is jQuery Mobile  A framework built on top of jQuery, used for creating mobile web applications  Designed to make.
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.
Getting Started with Expression Web 3
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
INTRODUCTION TO HTML5 CSS Styles. Understanding Style Sheets  HTML5 enables you to define many different types of content on a web page, including headings,
Web Technologies Website Development Trade & Industrial Education
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
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.
Bare bones notes. Suggested organization for main folder. REQUIRED organization for the 115 folder.
Website Development with Dreamweaver
JQuery UI. Slide 2 Introduction From the jQuery UI Home Page jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built.
 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.
Bare bones slide show. The format is text files, with.htm or.html extension. Hard returns, tabs, and extra spaces are ignored. DO NOT use spaces in file.
Week 11 Creating Framed Layouts Objectives Understand the benefits and drawbacks of frames Understand and use frame syntax Customize frame characteristics.
JQuery JavaScript is a powerful language but it is not always easy to work with. jQuery is a JavaScript library that helps with: – HTML document traversal.
Web Site Development - Process of planning and creating a website.
Introduction to JQuery COGS 187A – Fall JQuery jQuery is a JavaScript library, and allows us to manipulate HTML and CSS after the page has been.
CSU Extension Webpage Template Session 4 February 2010.
05 | Integrating JavaScript and MVC 4 Jon Galloway | Tech Evangelist Christopher Harrison | Head Geek.
Microsoft Office 2008 for Mac – Illustrated Unit D: Getting Started with Safari.
 Add one element at a time  If it doesn’t do what you want, › Delete it › DON’T just keep piling on more items.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Textbook to be published by Pearson Ed in early Bootstrap.
Header, Footer, and Navigation toolbars CIS 136 Building Mobile Apps 1.
© 2004 The McGraw-Hill Companies, Inc. All rights reserved. The Advantage Series Microsoft Office Word 2003 CHAPTER 4 Printing and Web Publishing.
HTML Extra Markup CS 1150 Spring 2017.
JQuery Fundamentals Introduction Tutorial Videos
CSCI 1720 W3.CSS – Part 1 East Tennessee State University Department of Computing CSCI 1720 Intermediate Web Design.
CNIT131 Internet Basics & Beginning HTML
Getting Started with Application Software
CSS Layouts: Positioning and Navbars
Tutorial Using the App help.ebsco.com.
Concepts for fluid layout
Building a User Interface with Forms
JQuery UI.
Bomgar Remote support software
Buttons, Headers, Footers, and Navigation
Tutorial 4: jQuery Mobile
Styles and the Box Model
Bootstrap Components Reusable components built to provide iconography, dropdowns, input groups, navigation, alerts, and much more.
Microsoft Office Illustrated Introductory, Windows XP Edition
Fixed Positioning.
Popups, Dialogs, Widgets, Panels
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
Tutorial 3 – Creating a Multiple-Page Report
Anatomy of an App User Interface Design
Tutorial 6 Creating Dynamic Pages
Tutorial Using the App help.ebsco.com.
Working with Text and Cascading Style Sheets
Web Development & Design Foundations with H T M L 5
Teaching slides Chapter 6.
SEEM4570 Tutorial 5: jQuery + jQuery Mobile
Buttons, Headers, Footers, and Navigation
Multipage Sites.
5.00 Apply procedures to organize content by using Dreamweaver. (22%)
Presentation transcript:

Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu Email: xuli@se.cuhk.edu.hk Department of Systems Engineering and Engineering Management

Recall points from previous lecture courses What is jQuery and why is it? jQuery is a JavaScript Library, which is the most popular and extendable among all JavaScript frameworks How to add jQuery to your project? Download jQuery Include from CDN (Content Delivery Network) jQuery Basic Syntax $(selector).on(event, action) $ define we use jQuery now (selector) is used to find HTML elements based on their names, ids, classes, types, attributes and so on event is the event that you want to monitor on those matched elements action is what you want to do when the event is triggered jQuery Animate

jQuery Callback (complement) Why this function? JavaScript statements are executed line by line. However, with effects, the next line of code can be run even though the effect is not finished. This can create errors. To prevent this, you can create a callback function. Advantages: A callback function is executed after the current effect is finished. Typical Syntax: $(selector).hide(speed,callback)

jQuery Chaining (Complement) Why this function? Until now we have been writing jQuery statements one at a time (one after the other).However, there is a technique called chaining, that allows us to run multiple jQuery commands, one after the other, on the same element(s). Advantages: Chaining allows us to run multiple jQuery methods (on the same element) within a single statement. This way, browsers do not have to find the same element(s) more than once. The following example chains together the css(), slideUp(), and slideDown() methods. The "p1" element first changes to red, then it slides up, and then it slides down:

jQuery Mobile What is jQuery Mobile? Why Use jQuery Mobile? jQuery Mobile is a touch-optimized web framework for creating mobile web applications. It works on all popular smartphones and tablets. jQuery Mobile is built on top of the jQuery library and uses HTML5, CSS3, JavaScript and AJAX to accomplish its work for laying out pages with minimal scripting. Why Use jQuery Mobile? jQuery Mobile takes the "write less, do more" to a new level: It automatically design web pages with an attractive and "easy-to-use" look, that will work the same way on all mobile devices. Instead of writing one application for each mobile device or OS, jQuery Mobile only uses HTML, CSS and JavaScript, which is standard for all mobile web browsers.

jQuery Mobile Install There are two ways to add jQuery Mobile to your web site: Link to a jQuery Mobile library stored at a CDN Link to a jQuery Mobile library stored at your computer Link to jQuery Mobile From a CDN As with jQuery core, there is nothing to install on your computer; you just include the following stylesheet (.css) and JavaScript libraries (.js) directly into your HTML page, to get jQuery Mobile to work:

jQuery Mobile Install Link to jQuery Mobile Stored at Your Computer If you want to host the jQuery Mobile library yourself, you must first download it from jQuerymobile.com. Then add the following code to your page:

jQuery Mobile Pages A simple, standard jQuery Mobile page:

jQuery Mobile Pages Adding Pages in jQuery Mobile In jQuery Mobile, you can create multiple pages in a single HTML file. Separate each page with a unique id and use the “href” attribute to link between them:

jQuery Mobile Buttons Creating a Button in jQuery Mobile A button in jQuery Mobile can be created in three ways: Using the <input> element Using the <button> element with class="ui-btn” Using the <a> element with class="ui-btn" Navigation Buttons To link between pages by buttons, use the <a> element with class="ui-btn":

jQuery Mobile Buttons Grouped Buttons Back Buttons jQuery Mobile provides an easy way for grouping buttons together. Use the data-role="controlgroup" attribute together with data-type="horizontal|vertical" in a container element, to specify whether to group buttons horizontally or vertically: Back Buttons To create a Back button, use the data-rel="back" attribute (this will ignore the anchor's href value):

jQuery Mobile Buttons Inline Buttons By default, buttons take up the full width of the screen. If you want a button that is only as wide as its content, or if you want two or more buttons to appear side by side, add the "ui-btn-inline" class:

jQuery Mobile Toolbars Toolbar elements are often placed inside headers and footers - for "easy-access" navigation: Header Bars 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). You can add buttons to the left and/or to the right side in the header. The code below, will add a "Home" button to the left and a "Search" button to the right of the header title text:

jQuery Mobile Toolbars Footer Bars The footer is located at the bottom of the page. The footer is more flexible than the header - it is more functional and changeable throughout pages, and can therefore contain as many buttons as needed: Positioning Headers and Footers The header and the footer can be positioned in three ways: Inline - Default. Headers and footers are inline with the page content Fixed - Headers and footers will remain positioned at the top and bottom of the page Full screen - Behaves like fixed; headers and footers will remain positioned at the top and bottom, but also over the page content. It is also slightly see-through

jQuery Mobile Navigation Bars A navigation bar consists of a group of links that are aligned horizontally, typically within a header or footer The bar is coded as an unordered list of links wrapped inside a <div> element that has the data-role="navbar" attribute:

jQuery Mobile Navigation Bars Icons in Navigation Buttons To add an icon to your navigation button, use the data-icon attribute: Positioning Icons Just like with the "ui-btn-icon-position" class, you can choose where the icon should be positioned in the navigation button: top, right, bottom or left. The icon position is set on the navbar container - it is not possible to position each individual button link. Use the data-iconpos attribute to specify the position.

jQuery Mobile Navigation Bars Active Buttons When a link in the navbar is tapped/clicked, it gets the selected (pressed down) look.To achieve this look without having to tap the link, use the class="ui-btn-active": For multiple pages, you might want the "selected" look for each button that represents the page the user is on. To do so, add the "ui-state-persist" class to your links, as well as the "ui-btn-active" class:

jQuery Mobile Panels Panels in jQuery Mobile will slide out from the left or the right side of the screen with additional content. To create a panel, add the data-role="panel" attribute to a <div> element and specify an id. Add any HTML markup inside this <div> that you want to display in your panel: Note: The panel markup must be placed before or after the header, content and footer inside a jQuery Mobile page.

jQuery Mobile Panels Closing Panels Positioning Panels You can close the panel by clicking outside of it, by swiping or by pressing the Esc key.  You can also close the panel by using a button: Just add a link inside the panel <div> with the data-rel="close" attribute attached to it. And for compatibility reasons, you should also specify the href attribute to point to the ID of the page the user should go to when closing the panel: Positioning Panels By default, panels will appear on the left side of the screen. For the panel to appear on the right side of the screen, specify the data-position="right" attribute.

There are still more features available within jQuery Mobile, you may access the following link to learn it more after this tutorial. http://www.w3c-schools.com/jquerymobile/default.asp.htm Thank you!

Question Time