Home arrow JavaScript arrow Tweaking the Sensitivity of the HoverIntent jQuery Plug-in
JAVASCRIPT

Tweaking the Sensitivity of the HoverIntent jQuery Plug-in


In this second part of the series you'll learn how to customize the default behavior of the “hoverIntent” jQuery plug-in by means of its “sensitivity” parameter. Thus, you'll be able to create different delayed rollovers in a truly simple fashion.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
May 27, 2010
TABLE OF CONTENTS:
  1. · Tweaking the Sensitivity of the HoverIntent jQuery Plug-in
  2. · Review: using the hoverIntent plug-in for a basic delayed rollover
  3. · Tweaking the plug-in's default behavior with the sensitivity parameter
  4. · The sensitivity argument in action

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Tweaking the Sensitivity of the HoverIntent jQuery Plug-in
(Page 1 of 4 )

Have you ever wanted to create clever rollover effects on your web pages that deliberately delay the execution of "mouseover/mouseout" events to prevent incidental calls to JavaScript functions or triggering undesired AJAX HTTP requests? Then you'll appreciate the "hoverIntent" plug-in, a small but powerful extension of jQuery that will let you control, via intuitive parameters, how long an HTML element will wait before triggering the aforementioned events when the mouse is placed over it.

Building delayed rollovers by means of plain JavaScript timers or through the "hoverIntent" plug-in may seem to be pointless at first glance, but this is a misconception, believe me. In reality, rollovers that are implemented in this way are generally more usable, even though they're a little bit harder to create than the ones that expose a standard behavior.

If you've already read the tutorial that precedes this one, you probably have a clear idea of how to use the "hoverIntent" plug-in to build a simple rollover animation on an (X)HTML document. In that case, the target element being animated was a basic div whose width was alternately expanded and contracted when a cursor hovered on it. Of course, the most interesting aspect of this process was the short delay added to the animation's "mouseover" event. This was achieved in a snap thanks to the flexibility offered by the plug-in's main method, not surprisingly called "hoverIntent" as well.

Speaking of flexibility, delayed rollovers can be easily customized via some optional arguments taken by the "hoverIntent()" method. To demonstrate how to accomplish this, in this second installment of the series I'm going to show how to modify the default behavior of the plug-in by tweaking one of these incoming arguments, called "sensitivity."

Want to see how this will be done in a few simple steps? Then jump ahead and begin reading!


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials