npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hover-cursor

v1.2.3

Published

Elevate user experience with seamless cursor interactions using hover-cursor, a small JS library. Create captivating web interfaces by dynamically crafting bespoke hover cursors that you can style however you need.

Downloads

60

Readme

Elevate user experience with seamless cursor interactions using hover-cursor, a powerful JS library. Create captivating web interfaces by dynamically crafting bespoke hover cursors that you can style however you need.

⭐️ Features

  • Custom cursor on hover of a target element
  • Small in size
  • Written purely in Typescript
  • Basic and really simple to use
  • Works everywhere, anytime
  • Options for custom functionality
  • Functionality styles, no styling limitations

📦 Getting Started

NPM

npm i hover-cursor

Yarn

yarn add hover-cursor

In your project, import the HoverCursor class like so:

import { HoverCursor } from 'hover-cursor'

Usage:

Note: If the element does not load, make sure you are initialising your HoverCursor after DOMContentLoaded!

new HoverCursor({
    containerQuery: '.floating-video',
    snapPosition: 'R'
})

🙋‍♂️ Example

The following code produces the behaviour displayed in the GIF.

import { HoverCursor } from 'hover-cursor'

document.addEventListener('DOMContentLoaded', () => {
    function toggleCursor() {
        console.log('Function called when element is clicked')
    }

    new HoverCursor({
        containerQuery: '.floating-video',
        snapPosition: 'R',
        title: 'Sound On',
        toggledTitle: 'Sound Off',
        toggledFunction: toggleCursor
    })
})
div.hover-cursor {
    width: 7rem;
    height: 7rem;
    border-radius: 50%;
    background: orange;
}

🚀 Documentation & Properties

Documentation is still being made as the libary is still being worked on, but a brief list is below,

| Parameter | Description | Default | Required? | | ------------------- | ----------------------------------------------------------------------------------------- | ------- | --------- | | containerQuery | Query to locate the target element(s) (the element[s] that we are watching to be hovered) | | ✅ | | snapPosition | L, M or R to define the snap position as left, middle or right | 'M' | ❌ | | customClass | Adds a custom class to the cursor | '' | ❌ | | title | The title to display in the markup | '' | ❌ | | toggledTitle | The title to toggle to after the target element (class) is clicked | '' | ❌ | | icon | The icon src to display in the markup (e.g. ./images/right-arrow.svg) | '' | ❌ | | toggledIcon | The icon to src toggle to after the target element is clicked | '' | ❌ | | toggledFunction | A callback function after the user clicked for custom functionality on click | null | ❌ |

🛣️ Roadmap (TODO)

  • Add in option to change the vertical snap position as well as horizontal
  • Optimise build process & update build tools
  • Add option to change the speed of transitions through parameters

💎 Contribution

I extend a warm invitation to developers and enthusiasts to contribute to hover-cursor. Your insights, expertise, and fresh perspectives are invaluable assets that can help me refine and enhance my work.

To get started, please review my guidelines for contributing, which can be found in the CONTRIBUTING.md file. If you encounter any issues, have questions, or need clarification, don't hesitate to reach out.