is-pointer-inside
v0.1.5
Published
Check if pointer is inside the element
Downloads
261
Readme
is-pointer-inside
Check if pointer is inside the element
Install
npm install --save is-pointer-inside
Usage
import isPointerInside from 'is-pointer-inside';
document.addEventListener('mousemove', event => {
const el = document.querySelector('.hello');
isPointerInside(el, event); // true if pointer inside the el
}, false);
API
isPointerInside(element, event)
Return true if pointer inside the element
.
element
Type: element
DOM element.
event
Type: object
Pointer event object with pageX
and pageY
props.
Related
- coordinates — calculate relative coordinates
- global-offset — element global offset
- is-pointer-near — check if pointer is near the element
License
MIT