Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 1.3 KB

README.MD

File metadata and controls

34 lines (28 loc) · 1.3 KB

MagneticHover

magneticHover lets you trigger hover effect on the element when the cursor is near it, but not over it yet.

creation of adam picture. hands crop
Usage

import MagneticHover from "magnetic-hover"

const htmlElement= document.getElementById('element')

function showDistance(distance){
  console.log(distance)
}
new MagneticHover({
  element:htmlElement
  radius:100,
  callback:showDistance
})

Settings:
element - HTML element radius - distance to element, where will work mousemove event callback - function

Example: some link to example