Hover Intent Detection jQuery Plugin | hoverIntent

hoverIntent is a plugin that tries to determine a user’s intent…like a crystal ball, just with a mouse movement! It is similar to jQuery’s scroll method.

However, instead of calling the handlerIn function immediately, hoverIntent waits for the user’s mouse to slow down enough before making the call.

How to make use of it:

1. Load the additional JavaScript file “jquery.hoverIntent.js” after the jQuery JavaScript library.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="jquery.hoverIntent.js"></script>

2. Basic usage is just like the .hover() method.

.hoverIntent( handlerIn, handlerOut )
.hoverIntent( handlerInOut )

3. Primary use with event authorization.

.hoverIntent( handlerIn, handlerOut, selector )
.hoverIntent( handlerInOut, selector )

4. Activate the plugin using the basic configuration object.

.hoverIntent({

  // The number of milliseconds hoverIntent waits between reading/comparing mouse coordinates. 
  // When the user's mouse first enters the element its coordinates are recorded. 
  // The soonest the "over" function can be called is after a single polling interval. 
  // Setting the polling interval higher will increase the delay before the first possible "over" call, but also increases the time to the next point of comparison. 
  interval: 100,

  // If the mouse travels fewer than this number of pixels between polling intervals, then the "over" function will be called. 
  // With the minimum sensitivity threshold of 1, the mouse must not move between polling intervals. 
  // With higher sensitivity thresholds you are more likely to receive a false positive. Note that hoverIntent r7 and earlier perform this comparison using rectilinear distance, whereas more recent versions compare against Euclidean (straight-line) distance for better accuracy and intuition. 
  // If you are upgrading from an older version, you may want to verify that the desired behavior is preserved. 
  sensitivity: 6,

  // A simple delay, in milliseconds, before the "out" function is called. 
  // 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). 
  // This is primarily to protect against sloppy/human mousing trajectories that temporarily (and unintentionally) take the user off of the target element... giving them time to return. 
  timeout: 0
  
})

Hover Intent Detection Plugin With jQuery Github


See Demo And Download

Official Website(briancherne): Click Here

This superior jQuery/javascript plugin is developed by briancherne. For extra Advanced Usages, please go to the official website.

Related Posts

svg-pan-zoom-container

Adding Zoom-on-Wheel and Pan-on-Drag to Inline SVG Elements

Vanilla-js module for adding zoom and panning behavior when dragging to SVG embedded elements. A lightweight Vanilla JavaScript plugin that enables zoom and pan functions on an…

html-table-sortable-js

Sorting HTML Table Vanilla JavaScript Library | Sortable.js

Sortable – Small JS vanilla table sorter makes any table with class = “sortable“, er, sortable. That is, the user can click the table header and change…

WYSIWYG-Rich-Text-Editor

WYSIWYG Rich Text Editor With jQuery And FontAwesome | RichText

RichText jQuery implementation for WYSIWYG Rich Text Editor which uses Font Awesome Iconic Font for editor icons. It is licensed under AGPL-3.0. Initialize editor Simply call .richText() on your jQuery(‘textarea’) or jQuery(‘input’)…

email-domain-autocomplete-genie

[Autocomplete] Email Domain Suggestions Like Gmail, Outlook, or More | email-genie

Email Genie allows auto-completion in the email field by providing a list of domain suggestions (gmail.com, outlook.com, etc.). This package is lightweight, flexible, compatible with libraries (jQuery,…

JavaScript-Library-for-Creating-Squircley-Magic

[Generator] JavaScript Library for Creating Squircley Magic ✨ | squircley.js

squircley.js is the core magic of Squirclular ✨ from https://squircley.app wrapped in a simple 0-dependency JavaScript library. squircley.js can generate SVG files, add square backgrounds to DOM…