Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
jQuery 1.4 Animation Techniques: Beginners Guide

You're reading from  jQuery 1.4 Animation Techniques: Beginners Guide

Product type Book
Published in Mar 2011
Publisher Packt
ISBN-13 9781849513302
Pages 344 pages
Edition 1st Edition
Languages
Concepts

Table of Contents (19) Chapters

jQuery 1.4 Animation Techniques Beginner's Guide
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Introduction 2. Fading Animations 3. Managing Animations 4. Sliding Animations 5. Custom Animations 6. Extended Animations with jQuery UI 7. Full Page Animations 8. Other Popular Animations 9. CSS3 Animations 10. Canvas Animations Pop Quiz Answers Index

Time for action – adding the mouse events


Now we need to add the mouse events that will trigger the animations:

prox.mouseenter(function(e) {

  message.text(pointerText).delay(1000).fadeOut("slow");

  goAnim(e);

  prox.mousemove(function(ev) {

    goAnim(ev);
  });
});

prox.mouseleave(function() {
  scroller.stop();
  prox.unbind("mousemove");
});

What just happened?

First we set a mouseeenter event handler so that we can detect when the pointer initially enters the proximity container. When this occurs we change the message text so that it shows what to do with the mouse pointer and then fade out the message slowly after a delay of one second.

We then call our goAnim() function to start the animation. At this point, we set a mousemove event so that we can increase or decrease the speed of the animation as the pointer moves within the proximity container. Each time the pointer moves, we call the goAnim() function once more. Each time this function is called we pass in the event object...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}