If the mouse travels fewer than this number of pixels between polling intervals, then the "over" function will be called. When choosing the default settings for hoverIntent I tried to find the best possible balance between responsiveness and frequency of false positives. Modify these only if you are brave, test tirelessly, and completely understand what you are doing. If the selector is null or omitted, the event is always triggered when it reaches the selected element. Used to filter the descendants of the selected elements that trigger the event. Default timeout: 0 selector:Ī selector string for event delegation. This is primarily to protect against sloppy/human mousing trajectories that temporarily (and unintentionally) take the user off of the target element. If the user mouses back over the element before the timeout has expired the "out" function will not be called (nor will the "over" function be called). timeout:Ī simple delay, in milliseconds, before the "out" function is called. Note, hoverIntent will only call the "out" function if the "over" function has been called. Your function receives the same "this" and "event" objects as it would from jQuery's hover method. The handlerOut function you'd like to call on "mouseleave after timeout". If the "over" function is sent alone (without "out") then it will be used in both cases like the handlerInOut param. The handlerIn function you'd like to call on "mouseenter with intent". Note, nothing prevents you from sending an empty function as the handlerIn or handlerOut functions. These are the common options you'll want to use. If the "over" function is sent alone, it will act just like handlerInOut. The object must at least contain an "over" function. To control hoverIntent more precisely and override the default configuration options, pass it an object as the first parameter. Unlike jQuery's hover, hoverIntent supports event delegation with handlerInOut.hoverIntent( object ) Unlike jQuery's hover, hoverIntent supports event delegation! Just pass in a selector of a descendant element.hoverIntent( handlerInOut, selector ) $("#demo5").hoverIntent( toggleHeight, 'li' ) HoverIntent can also take a single handlerInOut, just like jQuery's hover.hoverIntent( handlerIn, handlerOut, selector ) $("#demo4").hoverIntent( makeTall, makeShort, 'li' ) It passes the same this and event objects to those functions.hoverIntent( handlerInOut ) $("#demo3 li").hoverIntent( toggleHeight ) It can use the same exact handlerIn and handlerOut functions. HoverIntent is interchangeable with jQuery's hover.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |