# @notainc/mouse-hover-visible

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

Latest version **0.0.9** (published 2019-04-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @notainc/mouse-hover-visible
pnpm add @notainc/mouse-hover-visible
yarn add @notainc/mouse-hover-visible
bun add @notainc/mouse-hover-visible
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2019-04-19 |
| First published | 2019-02-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | akiroom, daiiz, mountainboooy, rakusai, shokai |
| Keywords | css, hover, pseudo |

## Links

- npm: https://www.npmjs.com/package/@notainc/mouse-hover-visible
- Repository: https://github.com/nota/mouse-hover-visible
- Issues: https://github.com/nota/mouse-hover-visible/issues
- npm.io page: https://npm.io/package/@notainc/mouse-hover-visible

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.0.9 (latest) — 2019-04-19
- 0.0.8 — 2019-03-04
- 0.0.7 — 2019-03-04
- 0.0.6 — 2019-02-18
- 0.0.5 — 2019-02-18
- 0.0.4 — 2019-02-15
- 0.0.3 — 2019-02-15
- 0.0.2 — 2019-02-14
- 0.0.1 — 2019-02-14

## README

# 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.

```js
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:

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

You can also use it in Sass:

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

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

### Demo

See the live demo [here](https://nota.github.io/mouse-hover-visible/demo.html)

### 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.

---
_Source: https://npm.io/package/@notainc/mouse-hover-visible · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
