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.
<spandata-skip-link="rel-container">Link</span><divid="rel-container">Content</div>This data attribute is for an additional close link. The value is the ID of the container which would be closed.
<spandata-skip-link="rel-container">Link</span><divid="rel-container"><p>Content</p><spandata-skip-close="rel-container">X</span></div>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.
<ul><li><ahref="#" data-skip-link="content-1" data-skip-group="nav">Content One</a><ahref="#" data-skip-link="content-2" data-skip-group="nav">Content Two</a></li></ul><divid="content-1">Content One</div><divid="content-2">Content Two</div>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.
<spandata-skip-link="rel-container" data-skip-breakpoint="400, 960">Link</span><divid="rel-container">Content</div>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.
<spandata-skip-link="rel-container"
data-skip-breakpoint="960"
data-skip-breakpoint-close>Link</span><divid="rel-container">Content</div>With the value open this data attribute trigger the skip link just on load so that it woult be active.
<spandata-skip-link="rel-container" data-skip-state="open">Link</span><divid="rel-container">Content</div>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-classattribute
<spandata-skip-link="rel-container" data-skip-class="my-is-visible-class"
>Link</span><divid="rel-container">Content</div>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.
<spandata-skip-link="rel-container" data-skip-ignore-body="true">Link</span><divid="rel-container">Content</div>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.
document.addEventListener('skipper:stateChange', (e) => {
console.log(`${e.type}: `, e.detail.cache); });