CHAPTER 12 UNLEASHING JAVASCRIPT USING JQUERY. LEARNING OBJECTIVES How to download the JQuery library. How to integrate the JQuery library into an HTML.

Slides:



Advertisements
Similar presentations
CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
Advertisements

Making Things Look Nice: Visual Appearance and CSS CMPT 281.
CHAPTER 8 ADVANCED CSS. LEARNING OBJECTIVES Assign formatting styles to a CSS class definition Use a tag’s class attribute to apply the styles defined.
Day 2 – JavaScript & PHP.  Have the hover effect display an extra image  Add an extra image for each of the tags  In your writeText() function, you.
Chapter 7 Using Advanced Cascading Style Sheets HTML5 & CSS 7 th Edition.
CS428 Web Engineering Lecture 15 Introduction to Jquery.
Philly.NET Hands-On jQuery + Plug-ins Bill Wolff, Rob Keiser.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
CHAPTER 28 INTEGRATING WEB WORKERS. LEARNING OBJECTIVES How a Web worker is essentially a JavaScript routine that performs concurrent processing within.
CHAPTER 24 PERFORMING CSS TRANSITIONS AND ANIMATIONS.
JQuery CS 268. What is jQuery? From their web site:
Cascading Style Sheets. Defines the presentation of one or more web pages Similar to a template Can control the appearance of an entire web site giving.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
JQuery Adding behaviour…. Lecture Plan Review of last lesson Adding behaviour –click, mouseover Animation –fade, slideDown Navigation –parent, find, next.
Title, meta, link, script.  The title looks like:  The tag defines the title of the document in the browser toolbar.  It also: ◦ Provides a title for.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Images in HTML Images in the foreground –src loaded separately; relative to home directory –Width & height set aside space in page; do not use this to.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
© 2012, Mike Murach & Associates, Inc.
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.
CHAPTER 5 jQuery อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
Department Name (View Master > Edit Slide 1) JQuery I took these slides from the site because they were pretty good looking.
JQuery Introduction © Copyright 2014, Fred McClurg All Rights Reserved.
Web Foundations WEDNESDAY, NOVEMBER 20, 2013 LECTURE 32: DREAMWEAVER SLIDE SHOW AND GOOGLE MAP.
Web Design Part I. Click Menu Site to create a new site root.
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.
Modifying HTML attributes and CSS values. Learning Objectives By the end of this lecture, you should be able to: – Select based on a class (as opposed.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
Dawn Pedersen. What is JavaScript? JavaScript is the basis for both jQuery and Spry applications JavaScript is referred to as a client-side scripting.
IS2802 Introduction to Multimedia Applications for Business Lecture 07: Introduction to jQuery Rob Gleasure
Unit 13 –JQuery Basics Instructor: Brent Presley.
CHAPTER 4 CREATING STYLES AND LAYOUTS WITH CSS. CHAPTER OBJECTIVES Create ID-based styles Position content with CSS Format text with CSS Identify CSS.
Introduction to jQuery. 2 Objectives When you complete this chapter, you will be able to: Select elements using jQuery syntax Use built-in jQuery functions.
USING JAVASCRIPT TO SHOW AN ALERT Web Design Sec 6-2 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
Web Technologies Lecture 8 JQuery. “A fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax.
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.
Chapter 1 Murach's JavaScript and jQuery, C1© 2012, Mike Murach & Associates, Inc.Slide 1.
Practice for Chapter 3: Assume that you are a freelance web designer and need to create a website to promote your freelance company.
JQuery Animation. If you look at example1.html, you will see that it is a basic web page with links to the jquery library, and a script.js file and some.
NASRULLAHIBA.  It is time to take your web designing skills to the next level with Cascading Style Sheets (CSS). They are a way to control the look and.
Adding Interactivity Comp 140 Fall Web 2.0 Major change in internet usage –From mostly static pages Text Graphics Simple links –To new paradigm.
HTML5 and CSS3 Illustrated Unit C: Getting Started with CSS.
HTML Introduction HTML Editors HTML Basic HTML Elements HTML Attributes HTML Headings HTML Paragraphs HTML Formatting HTML Links HTML Head HTML CSS HTML.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
CSCI 3100 Tutorial 5 JavaScript & Ajax Jichuan Zeng Department of Computer Science and Engineering The Chinese University of Hong.
COM621: Advanced Interactive Web Development Lecture 6 – JavaScript (cont.)
CSS.
Programming Web Pages with JavaScript
Using JavaScript to Show an Alert
Week 2: Introduction to Design and CSS
Week 4: Introduction to Javascript
Intro to JavaScript CS 1150 Spring 2017.
JQuery Basics 소속 / 작성자 이 문서는 나눔글꼴로 작성되었습니다. 설치하기.
Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu
JQUERY Online TRAINING AT GOLOGICA
AN INTRODUCTORY LESSON TO MAKING A SIMPLE WEB PAGE By: RC Emily Solis
CASCADING STYLE SHEET CSS.
HTML5 Level I Session II Chapter 3 - How to Use HTML to Structure a Web Page
JQuery with ASP.NET.
Web Programming Language
Some Stuff You Need to Know
An Introduction to Animation
SEEM4570 Tutorial 5: jQuery + jQuery Mobile
Web Programming and Design
Murach's JavaScript and jQuery (3rd Ed.)
Web Programming and Design
Murach's JavaScript and jQuery (3rd Ed.)
© 2017, Mike Murach & Associates, Inc.
Presentation transcript:

CHAPTER 12 UNLEASHING JAVASCRIPT USING JQUERY

LEARNING OBJECTIVES How to download the JQuery library. How to integrate the JQuery library into an HTML page. How to use JQuery to fade an element out or into a page. How to use JQuery to show or hide an element. How to use JQuery to slide a page division. How to use JQuery to animate an object. How to use JQuery to access HTML or CSS elements within a page.

JQUERY JQuery is a library of routines your pages can call using JavaScript. Instead, you access it much like an external JavaScript file. Developers often download the JQuery library from JQuery.com web site. After they download the JQuery library file, the developers then place a copy of the file into the folder that contains a page’s HTML files. Then, they link to the file within their page using a statement such as:

JQUERY SYNTAX To use JQuery, you generally specify an element on your page and the operation you want to perform on the element. The general JQuery syntax is: $(elementSelector).action(); The elementSelector corresponds to a selector you would use with CSS. Consider the following examples: $(this).fadeOut(); // fades out the current element $(“div”).fadeOut();// fades out all div elements $(“.classname”).fadeOut();// fades out elements that use the specified CSS class $(“#elementID”).fadeOut();// fades out the element with the id elementID

USING JQUERY TO FADE AN IMAGE function HideImage() { $("#Pets").fadeOut(8000); } Welcome to Debbie's Pet Site!

FADING ELEMENTS

JQUERY SLIDESHOW function FadeImage(I) { var Image = '#'+I; $(Image).fadeIn(); $(Image).fadeOut(5000, function() { FadeImage((I == 1) ? 3: I-1); }); }

JQUERY SLIDE FUNCTIONS

USING SLIDES function CloseSlide(Division) { Division = '#'+Division; $(Division).slideUp(); } function OpenSlide(Division) { Division = '#'+Division; $(Division).slideDown(); }

USING SLIDES CONTINUED A person who never made a mistake never tried anything new. Show Person Hide Person Better to remain silent and be thought a fool than to speak out and remove all doubt. Show Person Hide Person Be courteous to all, but intimate with few, and let those few be well tried before you give them your confidence. Show Person Hide Person

USING JQUERY TO SLIDE A BOX function SlideBox(Division) { Division = '#'+Division; $(Division).animate({ left:'600px', opacity: '0.2' }, 5000); }

USING A JQUERY ANIMATION TO REVEAL A PHOTO function RevealImage(Image) { $(Image).animate({ opacity: '1.0' }, 5000); }

JQUERY DOM-BASED FUNCTIONS

CREATING A DIV FOR AN IMAGE function DisplayImage(Pet) { if (Pet == 'Dog') $('#ImageSpace').html(' '); else $('#ImageSpace').html(' '); } Dog Cat

ADDING AND REMOVING PAGE ELEMENTS

ADDING AND REMOVING ELEMENTS var Images = [' ', ' ', ' ', ' ', ' ']; var i = 0; var AddImageTimer; var RemoveImageTimer; function AddImage(Division) { if (i == 0) { AddImageTimer = setInterval(function(){ AddImage(Division) }, 1000); $("button").hide(); } if (i < Images.length) { $(Division).append(Images[i]); i = i + 1; } else { i = i - 1; clearInterval(AddImageTimer); RemoveImage(Division); } }

ADDING AND REMOVING ELEMENTS CONTINUED function RemoveImage(Division) { if (i == (Images.length-1)) RemoveImageTimer = setInterval(function(){ RemoveImage(Division) }, 1000); if (i >= 0) { ImageId = '#'+i; $(ImageId).remove(); i = i - 1; } else { i = 0; clearInterval(RemoveImageTimer); AddImage(Division); } } Add Images

JQUERY AND CSS

JQUERY/CSS EXAMPLE function DisplayImage(Size) { if (Size == 'Big') $('#DogImage').css("width", "400px", "height", "300px"); else $('#DogImage').css("width", "200px", "height", "150px"); } Big Small

REAL WORLD: W3SCHOOLS AND JQUERY

SUMMARY JQuery provides a library of functions you can use to improve a user’s experience with your Web page. Using JQuery you can hide or show elements on a page, fade items in or out of view, slide open or closed page divisions, and set or retrieve HTML and CSS elements and attributes.