Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@notainc/mouse-hover-visible

Package Overview
Dependencies
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@notainc/mouse-hover-visible

This library allows you to show CSS :hover pseudo-class only when triggered by the mouse.

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
217
decreased by-65.22%
Maintainers
5
Weekly downloads
 
Created
Source

mouse hover visible

This library allows you to show CSS :hover pseudo-class only when triggered by the mouse.

There are several ways to achieve this goal. Advantages of our aproach are:

  • Works on the device that has both mouse and touch screen.
  • Write CSS (& Sass) cleanly among other pseudo-classes like :active or :focus.
  • Hide the hover style automatically when the keyboard is pressed.

Install

$ npm install @notainc/mouse-hover-visible

How to use

Just import/require this library to your project.

import '@notainc/mouse-hover-visible'

It sets data-hover-visible attribute on the body element when the pointer is moved using the mouse. So you can apply the style as follows:

[data-hover-visible] button:hover {
  background-color: #ccc;
}

You can also use it in Sass:

.foo-component {
  background-color: #fff;

  &:active,
  &:focus,
  [data-hover-visible] &:hover {
    background-color: #ccc;
  }
}

Demo

See the live demo here

Compatibility

Suports ordinary modern dekstop browsers (Chrome, Firefox, Safari, Opera, Edge) and mobile browsers (Chrome for Android, iOS Safari)

Does not throw error on IE.

License

This software is released under the MIT License, see LICENSE.

Keywords

FAQs

Package last updated on 19 Apr 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc