Skip to Content
JavaScript & jQuery: The Missing Manual, 3rd Edition
book

JavaScript & jQuery: The Missing Manual, 3rd Edition

by David Sawyer McFarland
September 2014
Beginner
686 pages
20h 43m
English
O'Reilly Media, Inc.
Content preview from JavaScript & jQuery: The Missing Manual, 3rd Edition

Chapter 6. Animations and Effects

In the last two chapters, you learned the basics of using jQuery: how to load the jQuery library, select page elements, and respond to events like a visitor clicking on a button or mousing over a link. Most jQuery programs involve three steps: selecting an element on the page, attaching an event handler to that element, and then responding to that event by doing something. In this chapter, you’ll start learning about the “doing something” part with jQuery’s built-in effect and animation functions. You’ll also get a little CSS refresher covering a few important CSS properties related to creating visual effects. In addition, you’ll also learn how to combine CSS3 animations with jQuery’s tools for super-smooth (and easy) animation effects.

jQuery Effects

Making elements on a web page appear and disappear is a common JavaScript task. Drop-down navigation menus, pop-up tooltips, and automated slideshows all rely on the ability to show and hide elements when you want to. jQuery supplies a handful of functions that achieve the goal of hiding and showing elements.

To use each of these effects, you apply them to a jQuery selection, like any other jQuery function. For example, to hide all tags with a class of submenu, you can write this:

$('.submenu').hide();

Each effect function also can take an optional speed setting and a callback function. The speed represents the amount of time the effect takes to complete, while a callback is a function that runs when the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JavaScript & jQuery: The Missing Manual, 2nd Edition

JavaScript & jQuery: The Missing Manual, 2nd Edition

David Sawyer McFarland
Learning jQuery 3 - Fifth Edition

Learning jQuery 3 - Fifth Edition

Adam Boduch, Jonathan Chaffer, Karl Swedberg
jQuery in Action, Third Edition

jQuery in Action, Third Edition

Bear Bibeault, Yehuda Katz, Aurelio De Rosa

Publisher Resources

ISBN: 9781491948583Errata Page