Home arrow JavaScript arrow Introducing the HoverIntent jQuery Plug-in

Introducing the HoverIntent jQuery Plug-in

In this first part of a series, I introduce you to using the “hoverIntent” jQuery plug-in for creating delayed rollovers in a truly painless fashion. If you’re familiar with the basics of jQuery, then getting the plug-in up and running even without checking its official documentation is a breeze.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 8
May 26, 2010
  1. · Introducing the HoverIntent jQuery Plug-in
  2. · Building a traditional rollover with jQuery
  3. · Introducing the hoverIntent jQuery plug-in
  4. · Including the JavaScript in a web page

print this article

Introducing the HoverIntent jQuery Plug-in
(Page 1 of 4 )

Frankly speaking, rollovers are one of those effects that have been used literally for years on HTML pages since the good old days when the web was an arid terrain comprised primarily of text-based documents, quite different from the flashing and eye-catching creature that all we see today. Being created from the very beginning with JavaScript and Java applets (remember those mid-90s nostalgic times?), rollovers have gone through a steady process of evolution. Nowadays it’s possible to implement them by using several technologies and languages, including client-side scripting, CSS and the always-controversial Flash.

As one might expect, however, with rollovers having such a long life, they’ve been overused and misused; you can see that today when surfing many modern websites. The sad part of this story is that this quirky trend has indirectly affected (although with a pretty negative impact) the way that certain interfacing elements are designed to work, including typical navigational bars.

But why am I saying this? Well, let me elaborate on this concept a bit further with a simple example. Suppose for a moment that you’ve proudly built for your website an engaging mega menu which will display a set of additional items when the mouse is placed over each of its sections. If the menu bases its functionality on CSS “hover” pseudo classes, the items will become immediately visible when a visitor hovers on them.

This isn’t always the desired behavior. Even though in most cases users will move the mouse across your menu following a common pattern, this doesn’t mean that they intend to visit a specific section. Obviously, the result of this process will be a bunch of menu sections expanding and shrinking alternately without a specific purpose. Are you experiencing the same “déjà vu” sensation that I have right now? I bet you are.

Of course, building a drop-down menu that behaves like this isn’t an evil thing at all, as long as it remains accessible in all cases. It’s possible, however, to improve the menu’s functionality by adding to it the ability to wait until the mouse is placed on a section for a while to display the corresponding items, thus introducing a short delay on its hover state. In reality, there are a few ways to accomplish this via plain JavaScript timers, but by far the easiest one is through a handy jQuery plug-in developed by Brian Cherne, called “hoverIntent.”

True to form, “hoverIntent” makes building “delayed” and more usable rollovers a breeze, which visitors to your website will surely appreciate. Therefore, in the lines to come I’m going to take a close look at this useful jQuery add-on, so you can learn how to play with its default settings and tweak them to fit your needs.

Let's get started. 

blog comments powered by Disqus

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


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