cursor-position-detector
v0.4.1
Published
Detect cursor position and switch cursor style.
Downloads
5
Readme
cursor-position-detector
Overview
Detect cursor position and switch cursor style.
Installation
You can install this library using npm:
npm install cursor-position-detector
Usage
import { CursorPositionDetector, Direction } from "cursor-position-detector";
const targetElement = document.querySelector("body") as Element;
new CursorPositionDetector({
element: targetElement,
threshold: 0.3,
disabledDirections: ["bottom"],
onClick: (direction: Direction) => console.log(`Clicked ${direction}`),
onEnter: (direction: Direction) => console.log(`Entered ${direction} zone`),
onLeave: (direction: Direction) => console.log(`Left ${direction} zone`),
});
License
This project is licensed under the MIT License - see the LICENSE file for details.