# es6.skip-links

> Define dependencies between items or group them together for better event handling

Latest version **2.5.2** (published 2020-08-12) · 0 weekly downloads

## Install

```sh
npm install es6.skip-links
pnpm add es6.skip-links
yarn add es6.skip-links
bun add es6.skip-links
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.5.2 |
| Published | 2020-08-12 |
| First published | 2019-11-25 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 73 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jan-Philipp Dombrowski |
| Maintainers | andreasisaak, felixbuenemann, patrickkahl |

## Links

- npm: https://www.npmjs.com/package/es6.skip-links
- Repository: git@gitlab.louis-net.de:lia/es6-skip-links
- npm.io page: https://npm.io/package/es6.skip-links

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.19
- [core-js](https://npm.io/package/core-js.md) ^3.4.2
- [regenerator-runtime](https://npm.io/package/regenerator-runtime.md) ^0.13.3

## Recent versions

- 2.5.2 (latest) — 2020-08-12
- 2.5.1 — 2020-06-29
- 2.5.0 — 2020-06-24
- 2.4.5 — 2019-11-25

## README

# SkipLinks

## Data attributes

### data-skip-link

Create a relationship between two elements. The element with the data attribute become clickable, no matter if it is an anchor, an list element or everything else. The value of the data attribute generates the relationshipt to an container with this particular id.

```html
<span data-skip-link="rel-container">Link</span>
<div id="rel-container">Content</div>
```

### data-skip-close

This data attribute is for an additional close link. The value is the ID of the container which would be closed.

```html
<span data-skip-link="rel-container">Link</span>
<div id="rel-container">
  <p>Content</p>
  <span data-skip-close="rel-container">X</span>
</div>
```

### data-skip-group

With this data attribute you can group links together. It only can be one open so the siblings close every time another group member is clicked.

```html
<ul>
  <li>
    <a href="#" data-skip-link="content-1" data-skip-group="nav">Content One</a>
    <a href="#" data-skip-link="content-2" data-skip-group="nav">Content Two</a>
  </li>
</ul>
<div id="content-1">Content One</div>
<div id="content-2">Content Two</div>
```

### data-skip-breakpoint

To stop the skip link functionality on a specific breakpoint you can use the `data-skip-breakpoint` attribute. If you only set one number the value stands for max. If you set two values the first in min and the second max.

```html
<span data-skip-link="rel-container" data-skip-breakpoint="400, 960">Link</span>
<div id="rel-container">Content</div>
```

### data-skip-breakpoint-close

If you want to close an open target on a specific breakpoint you can use the `data-skip-breakpoint` plus the `data-skip-breakpoint-close` attribute.

```html
<span
  data-skip-link="rel-container"
  data-skip-breakpoint="960"
  data-skip-breakpoint-close
  >Link</span
>
<div id="rel-container">Content</div>
```

### data-skip-state

With the value open this data attribute trigger the skip link just on load so that it woult be active.

```html
<span data-skip-link="rel-container" data-skip-state="open">Link</span>
<div id="rel-container">Content</div>
```

### data-skip-class

By default the class that whould be toggled is "is-visible". If you want your own class that whould be toggled add the `data-skip-class`attribute

```html
<span data-skip-link="rel-container" data-skip-class="my-is-visible-class"
  >Link</span
>
<div id="rel-container">Content</div>
```

### data-skip-ignore-body

By default a click on every element which is not a skip link or target trigger the close event for all open skip targets. With the `data-skip-ignore-body` attribute the global close whould be ignored on this element.

```html
<span data-skip-link="rel-container" data-skip-ignore-body="true">Link</span>
<div id="rel-container">Content</div>
```

## Events

### skipper:stateChange

With the `skipper:stateChange` you can add own logic to changes of each skip-link. The `event` argument contains the changed skip-link under the `detail` attribute.

```html
document.addEventListener('skipper:stateChange', (e) => {
console.log(`${e.type}: `, e.detail.cache); });
```

---
_Source: https://npm.io/package/es6.skip-links · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
