Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

cursor-position-detector

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cursor-position-detector

Detect cursor position and switch cursor style.

latest
Source
npmnpm
Version
0.4.1
Version published
Weekly downloads
12
140%
Maintainers
1
Weekly downloads
 
Created
Source

cursor-position-detector

npm version build codecov License

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.

Keywords

DOM

FAQs

Package last updated on 10 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts