Book Image

jQuery 2.0 Animation Techniques: Beginner's Guide - Second Edition

Book Image

jQuery 2.0 Animation Techniques: Beginner's Guide - Second Edition

Overview of this book

jQuery is a cross-browser JavaScript library designed to simplify the client-side scripting of HTML, and is the most popular JavaScript library in use today. Using the features offered by jQuery, developers are able to create dynamic web pages. jQuery empowers you with creating simple as well as complex animations. jQuery 2.0 Animation Techniques Beginner's Guide will teach you to understand animation in jQuery to produce slick and attractive interfaces that respond to your visitors' interactions. You will learn everything you need to know about creating engaging and effective web page animations using jQuery. In jQuery 2.0 Animation Techniques Beginner's Guide, each chapter starts with simple concepts that enable you to build, style, and code your way into creating beautifully engaging and interactive user interfaces. With the use of wide range of examples, this book will teach you how to create a range of animations, from subtle UI effects (such as form validation animation and image resizing) to completely custom plugins (such as image slideshows and parallax background animations). The book provides various examples that gradually build up your knowledge and practical experience in using the jQuery API to create stunning animations. The book uses many examples and explains how to create animations using an easy and step-by-step approach.
Table of Contents (18 chapters)
jQuery 2.0 Animation Techniques Beginner's Guide
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Animating with jQuery


jQuery (http://jquery.com) provides a range of animation methods natively, without the use of additional effect libraries or plugins. There are, however, many plugins contributed from the online community, including jQuery UI (http://jqueryui.com), the official UI library for jQuery, which extends jQuery's animation capabilities. Natively, jQuery provides methods that add sliding and fading behavior with minimal configuration and which work cross-browser. It also exposes methods related to managing the animation queue, and provides a means for creating custom animations that work on almost all numerical CSS styles. Over the course of this book, we'll look at every animation method that the library contains in detail. These methods are listed here with descriptions of each:

Methods

Description

animate()

It performs a custom animation of a set of CSS properties.

clearQueue()

It removes from the queue all items that have not yet been run.

delay()

It sets a timer to delay execution of subsequent items in the queue.

dequeue()

It executes the next function on the queue for the matched elements.

fadeIn()

It displays the matched elements by fading them to opaque.

fadeOut()

It hides the matched elements by fading them to transparent.

fadeTo()

It adjusts the opacity of the matched elements.

fadeToggle()

It displays or hides the matched elements by animating their opacity.

finish()

It stops the currently-running animation, removes all of the queued animations, and completes all of the animations for the matched elements.

hide()

It hides the matched elements.

queue()

It shows the queue of functions to be executed on the matched elements.

show()

It displays the matched elements.

slideDown()

It displays the matched elements with a sliding motion.

slideToggle()

It displays or hides the matched elements with a sliding motion.

slideUp()

It hides the matched elements with a sliding motion.

stop()

It stops the currently-running animation on the matched elements.

toggle()

It displays or hides the matched elements.

It's important to note that there are two properties that can change the Global jQuery Object. These are listed below:

Property

Description

jQuery.fx.interval

It is the rate (in milliseconds) at which animations fire.

jQuery.fx.off

It globally disables all animations.

All in all, it gives us a powerful and robust environment to easily add almost any type of animation that we can conceive.

Animation is also a popular theme for plugins, with many available plugins that bring different types of animations to our fingertips for instant implementation with minimal configuration. We'll look at several plugins later in the book.