Mobile Web Design Best Practices Three Approaches to Mobile Web: ◦ Develop a new mobile site with a.mobi TLD ◦ Create a separate website hosted within.

Slides:



Advertisements
Similar presentations
Introduction to Web Design Lecture number:. Todays Aim: Introduction to Web-designing and how its done. Modelling websites in HTML.
Advertisements

Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 7 Key Concepts 1 Copyright © Terry Felke-Morris.
The jQuery library. What is jQuery ? A javascript lightweight library Is very easy to use Is powerful Is cross-browser compatible Downloadable from jQuery.com,
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Today CSS HTML A project.
Presenter: James Huang Date: Sept. 26,  Introduction  Basics  Lists  Links  Forms  CSS 2.
A really fairly simple guide to: mobile browser-based application development (part 1) Chris Greenhalgh G54UBI / Chris Greenhalgh
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
JQuery A Javascript Library Hard things made eas(ier) Norman White.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
AJAX Asynchronous Javascript And XML. AJAX A lot of hype –It has been around for a while –Not complex Powerful approach to building websites –Think differently.
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
4.01 Cascading Style Sheets
Computer Information System Information System California State University Los Angeles Jongwook Woo CIS 461 Web Development I JQuery Part I Jongwook Woo,
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 7 Key Concepts 1 Copyright © Terry Felke-Morris.
Chapter 8 More on Links, Layout, and Mobile Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Philly.NET Hands-On jQuery + Plug-ins Bill Wolff, Rob Keiser.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 12: Building Responsive Webpages.
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.
CIT 256 Mobile Web Development Dr. Beryl Hoffman.
Lesson 15: Mobile Design and Layout Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver CS6.
Chapter 8 More on Links, Layout, and Mobile Copyright © 2013 Terry Ann Morris, Ed.D revised by Bill Pegram, 9/24/
WDV 331 Dreamweaver Applications Designing Websites for Mobile Devices Dreamweaver CS6 Chapter 11.
CIS 1310 – HTML & CSS 7 More on Links, Layout & Mobile.
Page Layout & Mobile Web Using columns, grid systems, etc… to layout sites for desktops and mobile.
Web Publishing 3  Meeting 2 1. Learning Outcomes  Configure float  Configure fixed positioning  Configure relative positioning  Configure absolute.
M. Taimoor Khan Courtesy: Norman White.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Nguyen Ich Cuong.  Course duration: 45’  Purpose: Present Introduction to JQuery  Targeted attendees: NICorp Trainee  Tests/quiz: Yes - 10’
1 Other Java Related Technologies. 2 HTML DOM 3 HTML DOM مجموعه ای استاندارد از اشیاء را برای HTML تعریف می کند و یک راه استاندارد برای دسترسی و دستکاری.
JQuery 10/21. Today jQuery Some cool tools around the web JavaScript Libraries Drawing libraries HTML Frameworks Conventions.
Dynamic HTML. A combination of technologies to create dynamic web pages – xhtml – CSS – Javascript Browsers make the page that is being displayed, its.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Week 8 – Part 3 More on Links, Layout, and Mobile Key Concepts 1.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Style Sheets for Print and Mobile Media Types Supplemental Material.
INTRODUCTION TO HTML5 Using jQuery with HTML5. Introducing jQuery  Although it is not a part of any W3C or WHATWG specification, jQuery performs an important.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 7 Key Concepts 1 Copyright © Terry Felke-Morris.
JQuery Youn-Hee Han
CHAPTER 5 jQuery อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
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.
JQuery Introduction © Copyright 2014, Fred McClurg All Rights Reserved.
Week 8 – Part 2 Page Layout Basics Key Concepts 1.
Browser scripting jQuery Edited by: Trần Thị Mỹ Dung Ref:w3schools.com.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 7 Key Concepts 1 Copyright © Terry Felke-Morris.
Introduction to HTML. _______________________________________________________________________________________________________________ 2 Outline Key issues.
20-753: Fundamentals of Web Programming 1 Lecture 6: Advanced HTML Fundamentals of Web Programming Lecture 6: Advanced HTML.
Positioning Objects with CSS and Tables
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.
Cheryl Wolfe Web Services Administrator Tampa-Hillsborough County Public Library James Day Electronic Services Librarian Embry-Riddle Aeronautical University.
JQuery Tutorial. What is jQuery jQuery is a JavaScript Library The purpose of jQuery is to make it much easier to use JavaScript on your website JavaScript.
Web Development & Design Foundations with HTML5
School of Business Administration
Web Development & Design Foundations with HTML5 8th Edition
Web Development & Design Foundations with HTML5
Introduction to jQuery
7 More on Links, Layout & Mobile.
Web Development & Design Foundations with HTML5 8th Edition
Web Development & Design Foundations with HTML5 7th Edition
Chapter 8 More on Links, Layout, and Mobile Key Concepts
Web Development & Design Foundations with HTML5 8th Edition
Web Development & Design Foundations with H T M L 5
Basics of Web Design Chapter 8 More on Links, Layout, and Mobile Key Concepts Copyright © 2014 Terry Ann Morris, Ed.D.
Chapter 7 Absolute/relative hyperlinks Frag id 3-column site
Web Development & Design Foundations with HTML5
Presentation transcript:

Mobile Web Design Best Practices Three Approaches to Mobile Web: ◦ Develop a new mobile site with a.mobi TLD ◦ Create a separate website hosted within your current domain targeted for mobile users ◦ Use CSS to configure your current website for display on both mobile and desktop devices

Mobile Web Limitations  Small Screen Size  Low bandwidth  Limited fonts  Limited color  Awkward controls  Limited processor and memory  Cost per kilobyte

Design Techniques for Mobile Web One column design Avoid floats, tables, frames Descriptive page title Descriptive heading tags Optimize images Descriptive alt text for images Eliminate unneeded images Navigation in lists Provide “Skip to Content” hyperlink Provide “Back to Top” hyperlink Notice the overlap between these techniques and designing to provide for accessibility?

Design Techniques for Mobile Web Single column design Avoid floats, tables, frames Descriptive page title Descriptive headings Optimize images Descriptive alt text for images Eliminate unneeded images Navigation in lists Em or percentage font size units Common font typefaces Good contrast between text and background colors Provide “Skip to Content” hyperlink Provide “Back to Top” hyperlink Notice the overlap between these techniques and designing to provide for accessibility?

Viewport Meta Tag Default action for most mobile devices is to zoom out and scale the web page  Viewport Meta Tag Created as an Apple extension to configure display on mobile devices Configures width and initial scale of browser viewport 5

Telephone & Text Message Hyperlinks  Telephone Scheme Call Many mobile browsers will initiate a phone call when the hyperlink is clicked.  SMS Scheme Text Many mobile browsers will initiate a text message to the phone number when the hyperlink is clicked. 6

Responsive Web Design  Term coined by Ethan Marcotte  Progressively enhancing a web page for different viewing contexts  Techniques: Fluid Layout CSS3 Media Queries Flexible Images 7

CSS3 Media Queries  Media Query Determines the capability of the mobile device, such as screen resolution Directs the browser to styles configured specifically for those capabilities  Link Element Example:  CSS only screen and (max-width: 480px) { header { background-image: url(mobile.gif); } 8

Flexible Images  Edit HTML: remove height and width attributes  CSS: img { max-width: 100%; height : auto; } 9

Testing Mobile Display Options  Test with a mobile device  Emulators Opera Mobile Emulator Mobilizer Opera Mini Simulator iPhone Emulator  Test with a Desktop Browser  Install an iOS or Android SDK 10

CSS Debugging Tips  Manually check syntax errors  Use W3C CSS Validator to check syntax errors  Configure temporary background colors  Configure temporary borders  Use CSS comments to find the unexpected /* the browser ignores this code */  Don’t expect your pages to look exactly the same in all browsers!  Be patient! 11

What is jQuery?  A library of JavaScript functions  Features Select and manipulate HTML Manipulate CSS JavaScript Effects and animations HTML DOM traversal and modification AJAX Utilities

Getting Started Fun with jQuery Hello, jQuery! Say Ouch $("#btnOuch").click(function(){ alert("Ouch! That hurt."); });  Include jQuery in the source file  Define jQuery functions  Save this file as index.htm in a 216/jQuery subdirectory on ned  Try it!

Example 1: A Closer Look  $("#btnOuch") selects the element with ID btnOuch  click() binds a click event to selected element  The function executes when the click event is fired $("#btnOuch").click(function(){ alert("Ouch! That hurt."); }); Display an alert when the button with ID btnOuch is clicked

How jQuery Works  The jQuery syntax is used to select HTML elements and perform some action on those element(s).  Basic syntax: $(selector).action() A dollar sign to define jQuery A (selector) to find HTML elements An action() to be performed on the element(s) ntax.asp

jQuery Selectors SyntaxDescription $(this)Current HTML element $("p")All elements $("p.intro")All elements with class="intro" $(".intro")All elements with class="intro" $("#intro")The first element with id="intro" $("ul li:first")The first element of each $("[href$='.jpg']")All elements with an href attribute that ends with ".jpg" $("div#intro.head") All elements with class="head" inside a element with id="intro" For a full reference please see jQuery Selectors ReferencejQuery Selectors Reference

Comparison  Compare the following: What are the advantages of the jQuery method? $("a").click(function(){ alert("You clicked a link!"); }); Link

Example 2 $("h2").click(function(){ $(this).hide("slow"); }); What will this do? What happens if you have more than one h2? Try it!

Example 3 $("#btnHideBlue").click(function(){ $("p.blue").hide("slow"); }); Hide all blue paragraphs when btnHideBlue is clicked Hide Blue

jQuery Events Event MethodDescription $(selector).click(function) Invokes a function when the selected elements are clicked $(selector).dblclick(function) Invokes a function when the selected elements are double-clicked $(selector).focus(function) Invokes a function when the selected elements receive the focus $(selector).mouseover(function) Invokes a function when the mouse is over the selected elements $(selector).keypress(function) Invokes a function when a key is pressed inside the selected elements For a full jQuery event reference, please see jQuery Events ReferencejQuery Events Reference

Example 4 $("#lemon").mouseover(function(){ $(this).append(" Cookie! "); }); Append text to paragraph lemon on mouseover Lemon drops biscuit chocolate…

Manipulating CSS CSS PropertiesDescription $(selector).css(propertyName) Get the style property value of the first selected element $(selector).css(propertyName,value) Set the value of one style property for selected elements $(selector).css({properties}) Set multiple style properties for selected elements $(selector).addClass(class) Apply style class to the selected elements For a full jQuery CSS reference, please see jQuery CSS Methods ReferencejQuery CSS Methods Reference For more on the css function, see

Example 5 $("#btnColor").click(function(){ $("#lemon").addClass("blue"); }); Change color of paragraph lemon when btnColor is clicked.red{ color:red; }.blue{ color:blue; }

Example 6 Display the color of the paragraph lemon when btnColorCheck is clicked. What color is the paragraph? $("#btnColorCheck").click(function(){ alert($("#lemon").css("color")); });

Example 7 $("p").dblclick(function(){ $(this).css("background-color", "yellow"); }); Highlight (background-color = yellow) any paragraph that is double-clicked

jQuery Effects FunctionDescription $(selector).hide()Hide selected elements $(selector).show()Show selected elements $(selector).toggle()Toggle (between hide and show) selected elements $(selector).slideDown()Slide-down (show) selected elements $(selector).slideUp()Slide-up (hide) selected elements $(selector).slideToggle()Toggle slide-up and slide-down of selected elements $(selector).fadeIn()Fade in selected elements $(selector).fadeOut()Fade out selected elements $(selector).fadeTo()Fade out selected elements to a given opacity $(selector).fadeToggle()Toggle between fade in and fade out

Example 8 $("#btnToggle").click(function(){ $("#lemon").slideToggle("slow"); }); Create a toggle button that shows/hides paragraph lemon.

Example 9 $("#btnFade").click(function(){ $("#lemon").fadeTo("slow", 0.5); }); Fade paragraph lemon to 50% opacity when btnFade is clicked.

Manipulating HTML FunctionDescription $(selector).html(content) Changes the (inner) HTML of selected elements $(selector).append(content) Appends content to the (inner) HTML of selected elements $(selector).after(content)Adds HTML after selected elements For a full jQuery HTML reference, please see jQuery HTML Methods ReferencejQuery HTML Methods Reference

Example 10 $("#btnReplace").click(function(){ $("#lemon").html("Lollipop soufflé ice cream tootsie roll donut..."); }); Replace text in paragraph lemon when btnReplace is clicked.

Ajax  The jQuery $.post() method loads data from the server using an HTTP POST request.  Syntax $.post(URL, {data}, function(data){…}); $.post("myScript.php", {name:txt}, function(result) { $("span").html(result); }); ajax.php ParameterDescription URLRequired. Specifies the url to send the request to. dataOptional. Specifies data to send to the server along with the request. function(data) Optional. Specifies a function to run if the request succeeds. data - contains the resulting data from the request

Ajax <?php $id = $_POST['id']; mysql_connect("localhost", "omuser", "omuser") or die("Error connecting"); mysql_select_db("om") or die("Error selecting DB"); $query = "SELECT * FROM items WHERE item_id = $id"; $result = mysql_query($query); if (mysql_num_rows($result) == 0) { echo "Product ID $id not found."; return; } $row = mysql_fetch_array($result); echo " Item ID: {$row['item_id']} "; echo " Title: {$row['title']} "; echo " Artist: {$row['artist']} "; echo " Price: {$row['unit_price']} "; Get this from the Ajax call show_product.php

Ajax $('#show').click(function(){ var prodId = $('#id').val(); $.post( "show_product.php", {id:prodId}, function(result) { $('#detail').html(result); } ); }); When the button is clicked Get the text box value Name of the PHP script The key/value to be passed Update the "detail" div With the output of the PHP script Ajax POST ajax.php

Resources   