mirror of
https://github.com/imfing/hextra.git
synced 2025-08-25 16:26:45 -04:00
feat(banner): add top banner (#777)
* 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
This commit is contained in:

committed by
GitHub

parent
990d24906b
commit
f297d24189
15
assets/js/banner.js
Normal file
15
assets/js/banner.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// {{- 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 -}}
|
Reference in New Issue
Block a user