mirror of
https://github.com/imfing/hextra.git
synced 2025-08-25 04:28:21 -04:00

* feat: add top banner * chore: use inside the example site * chore: generate * fix: banner with the burger navbar * fix: compute the banner height to allow mutliple lines * chore: better p style
16 lines
588 B
JavaScript
16 lines
588 B
JavaScript
// {{- if site.Params.banner }}
|
|
(function () {
|
|
const banner = document.querySelector(".hextra-banner")
|
|
document.documentElement.style.setProperty("--hextra-banner-height", banner.clientHeight+"px");
|
|
|
|
const closeBtn = banner.querySelector(".hextra-banner-close-button");
|
|
|
|
closeBtn.addEventListener("click", () => {
|
|
document.documentElement.classList.add("hextra-banner-hidden");
|
|
document.documentElement.style.setProperty("--hextra-banner-height", "0px");
|
|
|
|
localStorage.setItem('{{ site.Params.banner.key | default `banner-closed` }}', "0");
|
|
});
|
|
})();
|
|
// {{- end -}}
|