Provides delegate-able hover events.
A hover happens when the mouse stops moving over an element for a period of time. You can listen and configure hover with the following events:
hoverinit - called on mouseenter, use this event to customize
jQuery.Hover.delay and jQuery.Hover.distancehoverenter - an element is being hoveredhovermove - the mouse moves on an element that has been hoveredhoverleave - the mouse leaves the element that has been hoveredThe following listens for hoverenter and adds a class to style the element, and removes the class on hoverleave.
$('#menu').delegate(".option","hoverenter",function(){
$(this).addClass("hovering");
}).delegate(".option","hoverleave",function(){
$(this).removeClass("hovering");
})An element is hovered when the mouse moves less than a certain distance in specific time over the element.
You can configure that distance and time by
adjusting the distance and
delay values.
You can set delay and distance globally by adjusting the static properties:
$.Hover.delay = 10
$.Hover.distance = 1Or you can adjust delay and distance for an individual element in hoverenter:
$(".option").live("hoverinit", function(ev, hover){
//set the distance to 10px
hover.distance(10)
//set the delay to 200ms
hover.delay(10)
})new $.Hover() -> jquery.hover
{jquery.hover}