feat(vitrine): proposition « Horizon nuit » (nocturne, or, serif)
- Cormorant Garamond + Sora, fond profond et halos discrets - Accueil en colonnes : prose vitrée, principes en file or, zone constellation - Nav minimaliste caps, menu mobile, CTA en contours dorés - Pages intérieures en panneau translucide Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
(function () {
|
||||
var nav = document.getElementById("hn-nav");
|
||||
if (!nav) return;
|
||||
var toggle = document.getElementById("hn-nav-toggle");
|
||||
var mq = window.matchMedia("(max-width: 51.99rem)");
|
||||
|
||||
function setOpen(open) {
|
||||
nav.classList.toggle("is-open", open);
|
||||
if (toggle) {
|
||||
toggle.setAttribute("aria-expanded", open ? "true" : "false");
|
||||
toggle.setAttribute("aria-label", open ? "Fermer le menu" : "Ouvrir le menu");
|
||||
}
|
||||
}
|
||||
|
||||
if (toggle) {
|
||||
toggle.addEventListener("click", function () {
|
||||
var next = !nav.classList.contains("is-open");
|
||||
setOpen(next);
|
||||
if (next) {
|
||||
var first = nav.querySelector(".hn-nav-list a");
|
||||
if (first) requestAnimationFrame(function () { first.focus(); });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("keydown", function (e) {
|
||||
if (e.key === "Escape" && nav.classList.contains("is-open")) {
|
||||
setOpen(false);
|
||||
if (toggle) toggle.focus();
|
||||
}
|
||||
});
|
||||
|
||||
nav.querySelectorAll(".hn-nav-list a").forEach(function (a) {
|
||||
a.addEventListener("click", function () {
|
||||
if (mq.matches) setOpen(false);
|
||||
});
|
||||
});
|
||||
|
||||
mq.addEventListener("change", function (ev) {
|
||||
if (!ev.matches) setOpen(false);
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user