Chapter 4: Feature Detection & Drag and Drop

Slides:



Advertisements
Similar presentations
Modernize Your Old Browser to Support HTML 5 Svetlin Nakov Telerik Software Academy academy.telerik.com Senior Technical Trainer
Advertisements

HTML5 Overview HOANGPT2. 1. General 2. New Elements List 3.
What is HTML5…?. ”…removes the need for plugins” ”…can handle multimedia directly” ”…enables rich, interactive clients” ”…enables advanced visual designs”
HTML5, OVERVIEW AND NEW FEATURES PowerPoint by Mason O’Mara.
HTML5 Media API.
HTML5 Haptics Standardization
SHAREPOINT PAKISTAN USER GROUP #1 SHAREPOINT COMMUNITY IN PAKISTAN AND ASIA HTML5 and SharePoint 2013.
HTML 5. What is HTML5? HTML5 will be the new standard for HTML, XHTML, and the HTML DOM. The previous version of HTML came in The web has changed.
HTML 5 Tutorial Chapter 1 Introduction. What is HTML5? HTML5 will be the new standard for HTML, XHTML, and the HTML DOM. The previous version of HTML.
HTML Advanced: HTML 5. Welcome This slideshow presentation is designed to introduce you to HTML 5. It is the third of three HTML workshops available at.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
Mark Branom, Continuing Studies.  HTML5 overview – what’s new?  New HTML5 elements  New HTML5 features  Guided Demonstrations  Forms  Video  Geolocation.
INTRODUCTION TO CLIENT-SIDE WEB PROGRAMMING ACM 511 ACM 262 Course Notes.
HTML5. What is HTML5? HTML5 will be the new standard for HTML. HTML5 is the next generation of HTML. HTML5 is still a work in progress. However, the major.
HTML 5 New Standardization of HTML. I NTRODUCTION HTML5 is The New HTML Standard, New Elements New Attributes Full CSS3 Support Video and Audio 2D/3D.
INTRODUCTION TO HTML5 Drag and Drop in HTML5. Browsers Support  Currently, most of the major HTML5 desktop web browsers support the new HTML5 drag-and-drop.
HTML5 Accessibility Ted Drake, Yahoo! Accessibility Lab Slideshare.net/7mary4.
IE11 Preview is here! Briefing prepared for the IE MVPs and IE userAgents communities.
HTML Advanced: HTML 5. Introduction to HTML 5 These slides are based on source material found at the w3schools.com website.
Proglan Session 1. .  HTML5 will be the new standard for HTML.  The previous version of HTML, HTML 4.01, came in The web has changed a lot since.
MIS 425 Lecture 3 – HTML 5 and CSS Instructor: Martin Neuhard
Presented By: Mahmoud Ghoz Internet Explorer 9 and HTML5 for Developers.
HTML5, part III – API, … Štěpán Developer Evangelist Microsoft, Czech Republic.
Session: 1. © Aptech Ltd. 2Introduction to the Web / Session 1  Explain the evolution of HTML  Explain the page structure used by HTML  List the drawbacks.
CSS 2D Transforms CSS 3D Transforms CSS Animations CSS Backgrounds & Borders CSS Color CSS Flexbox CSS Fonts CSS Grid CSS Hyphenation CSS Image Values.
HTML5&CSS3. Webpage Editors Notepad++ TextWrangler (Mac Users) Dreamweaver Editplus plus.sourceforge.net/uk/site.htm
UPLOAD / DOWNLOAD april  HTML5 is just the next iteration of HTML  Previous version was technically HTML 4.01, which incorporated XHTML 1.0.
Computer Science and Software Engineering© 2014 Project Lead The Way, Inc. HTML5 Evolving Standards JavaScript.
Wednesday 5 December 2012 Part II. Wednesday 5 December Make an Element Draggable What to Drag - ondragstart and setData() Where to Drop - ondragover.
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.
HTML5 & CSS3 A Practical Guide. HTML5 is more than HTML5 HTML5 Spec CSS3 Spec Web Fonts JavaScript to tie it all together.
Rich Internet Applications 9. HTML 5 and RIAs. HTML 5 Standard currently under development by W3C Aims to improve the language with support for the latest.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
XHTML. What Is XHTML? XHTML stands for EXtensible HyperText Markup Language XHTML is almost identical to HTML XHTML is stricter than HTML XHTML is HTML.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
HTML Structure & syntax
HTML Structure & syntax
Chapter 9 HTML 5 Video and Audio
The HTML5 logo was introduced by W3C in 2010
Creating Visual Effects
HTML5 Basics.
Programming Web Pages with JavaScript
Drag-and-Drop By Michelle
Chapter 2 Developing a Web Page.
Chapter 4: Scalable Vector Graphics (SVG)
Development of Internet Applications HTML5
PPT By:Gaurav Jaiswal Singsys Pte. Ltd.
Chapter 4: HTML5 Media - <video> & <audio>
HTML 5 Tutorial Chapter 1 Introduction.
Creating Visual Effects and Animation
Application with Cross-Platform GUI
Introduction to JavaScript
Introduction to HTML5.
Web Systems Development (CSC-215)
CSS3 and New HTML5 Tools.
Browser Support for HTML5
Chasing the evolving web
Drag-and-Drop Processing
Progress <progress value="22" max="100"></progress>
Simple Canvas Example Your browser doesn’t support canvases var canvas = document.getElementById("canvas1"); var context.
Javascript and JQuery SRM DSC.
Introduction to HTML5.
Introduction to JavaScript
CIS 133 mashup Javascript, jQuery and XML
Giuseppe Attardi Università di Pisa
HTML Structure & syntax
Introduction to HTML5.
Session IV Chapter 15 - How Work with Fonts and Printing
Web Programming and Design
HTML5 – A few features L. Grewe.
Presentation transcript:

Chapter 4: Feature Detection & Drag and Drop HTML5 Video Series Chapter 4: Feature Detection & Drag and Drop

What Is Feature Detection? Finding specific properties or methods in a browser's DOM to detect the browser type and whether it supports a given operation HTML5 Video Series It is NOT Browser detection Developers use to use “UA Sniffing” to detect the user’s browser using the navigator.userAgent property. This would detect the actual browser but was unreliable. This is now obsolete and not recommended

Modernizr HTML5 Video Series At the moment, the best way to detect HTML5 and CSS3 features are by using 3rd party Javascript libraries such as Modernizr. Modernizr does not try to detect the browser but it detects certain features. You can download Modernizr at http://modernizr.com/download/ and actually pick and choose what features you want to search for and it will generate a Javascript file to include in your HTML5 website. Once implemented you would use simple programming such as the lines below if (document.querySelector) { element = document.querySelector(selectors); } HTML5 Video Series

What Modernizr Detects CSS Animations CSS Gradients CSS Transforms Drag & Drop SVG Web GL Geolocation Local and Session Storage Canvas Web Fonts Flexi Box Model HTML5 History Web Sockets Web Workers HTML5 Input Types Application Cache HTML5 Video Series

How Do We Implement Modernizr? HTML5 Video Series All you need to do is download the file, include it in your <head> section and add class=“no-js” to your <html> tag <!DOCTYPE html> <html class="no-js"> <head> <meta charset="utf-8"> <title>HTML 5 and CSS3 Test Page</title> <script src="modernizr-2.0.6.min.js"></script> </head>

Testing For Object & Properties HTML5 Video Series Modernizr creates properties for all of the features that it tests for. You can refer to these properties to check whether the browser supports the object and its properties. Here is an example that checks to see if canvas is supported… if (Modernizr.canvas) { // Yes, canvas is supported } else { // No, canvas is not supported }

Updated CSS HTML5 Video Series For CSS3 able browsers, we can use new gradient properties such as linear-gradient. With Modernizr, we can use the no-js and no- cssgradients rule to tell a browser that does not support CSS3 gradients, to use a specified background image instead of just ignoring it.. .no-js .glossy, .no-cssgradients .glossy { background: url("glossybutton.png"); } .cssgradients .glossy { background-image: linear-gradient(top, #555, #333); HTML5 Video Series

Drag and Drop Feature HTML5 Video Series HTML5 and Javascript allow us to "grab" an object and drag it to a different location. In HTML5, drag and drop is part of the standard, and any element can be draggable. IE 9, Firefox, Opera 12, Chrome, and Safari 5 support drag and drop.

Drag And Drop Syntax HTML5 Video Series We need to set the “draggable” attribute to “true” <img draggable="true"> We specify what we want to drag with ondragstart and the setData() function function drag(ev){ ev.dataTransfer.setData("Text",ev.target.id); } HTML5 Video Series

Drag And Drop Syntax 2 HTML5 Video Series By default, data/elements cannot be dropped in other elements. To allow a drop, we need to prevent the default handling of the element. We do this with the event.preventDefault() function event.preventDefault() Now the drop event function drop(ev){ ev.preventDefault(); var data=ev.dataTransfer.getData("Text"); ev.target.appendChild(document.getElementById(data)); } HTML5 Video Series

Lets Dive In! HTML5 Video Series Start Coding!