Skip to Main Nav Link [Snippet] <> No-Code Supply Co.
Skip to Main Nav Link
window.addEventListener("DOMContentLoaded", (event) => {
let skipLinkEle = document.getElementById("skip-link");
if (!skipLinkEle) {
return;
}
skipLinkEle.addEventListener("click keydown", function (e) {
if (e.type === "keydown" && e.which !== 13) {
return;
}
e.preventDefault();
var target = document.getElementById("main");
target.setAttribute("tabindex", "-1");
target.focus();
});
});
view raw skip-nav.js hosted with ❤ by GitHub

A function that can be used with a skip to main button in your navigation. The skip button should only be visible on focus and enables keyboard only users to jump past a lengthy nav of links directly to the main content.

Have feedback or a question related to this item? Drop us some feedback!

Curated: 
6.14.23

Similar items

Also

3.26.25

Hurry Up & Have Fun

3.24.25

Cleft Notes

3.22.25

Typography in web design course

€399
3.22.25

Modulify AI

3.22.25

Webflow Expert Course

3.22.25

Dreamr

3.22.25

Website Headlines (dotcom)

3.18.25

Plumb

3.18.25

Elevate Sphere

3.17.25

Rubus

3.14.25

brand.ai

3.14.25

Tiny Mighty Buttons

3.14.25

DeepFlow

3.13.25

Sections.wtf

3.13.25

Mast

3.13.23

Birch

3.11.25

Whalesync

1.8.23

Praxis Leandra Isler

3.10.25

Ditto

3.10.25

Frontify

3.10.25

Fleur MCP App Store

3.10.25

Jetboost

12.3.19

Fathom Analytics

12.1.22

Fondu

3.6.25

Pasha Ink

3.4.25
Load more

Bummer, no results

Try a different search/filter combo, or drop us some feedback if there is something missing you would love to see!

Reset filters

Subscribe for updates

Get updates on the latest curated resources and be the first to hear of new features.