Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
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.

latest
Source
npmnpm
Version
0.0.9
Version published
Weekly downloads
350
-22.39%
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

css

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