Prepare migration to Tailwind
This commit is contained in:
47
static/builds/header.js
Normal file
47
static/builds/header.js
Normal file
@@ -0,0 +1,47 @@
|
||||
// assets/js/header.js
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const offcanvasToggle = document.querySelector(".cs-header__offcanvas-toggle");
|
||||
const offcanvasClose = document.querySelector(".cs-header__offcanvas-close");
|
||||
const offcanvas = document.querySelector(".cs-header__offcanvas");
|
||||
const overlay = document.querySelector(".cs-search-overlay");
|
||||
if (offcanvasToggle) {
|
||||
offcanvasToggle.addEventListener("click", function() {
|
||||
offcanvas.classList.add("active");
|
||||
overlay.style.display = "block";
|
||||
document.body.style.overflow = "hidden";
|
||||
});
|
||||
}
|
||||
if (offcanvasClose) {
|
||||
offcanvasClose.addEventListener("click", function() {
|
||||
offcanvas.classList.remove("active");
|
||||
overlay.style.display = "none";
|
||||
document.body.style.overflow = "";
|
||||
});
|
||||
}
|
||||
const searchToggle = document.querySelectorAll(".cs-header__search-toggle");
|
||||
const searchClose = document.querySelector(".cs-search__close");
|
||||
const search = document.querySelector(".cs-search");
|
||||
searchToggle.forEach((toggle) => {
|
||||
toggle.addEventListener("click", function() {
|
||||
search.style.display = "block";
|
||||
overlay.style.display = "block";
|
||||
document.body.style.overflow = "hidden";
|
||||
});
|
||||
});
|
||||
if (searchClose) {
|
||||
searchClose.addEventListener("click", function() {
|
||||
search.style.display = "none";
|
||||
overlay.style.display = "none";
|
||||
document.body.style.overflow = "";
|
||||
});
|
||||
}
|
||||
if (overlay) {
|
||||
overlay.addEventListener("click", function() {
|
||||
offcanvas.classList.remove("active");
|
||||
search.style.display = "none";
|
||||
overlay.style.display = "none";
|
||||
document.body.style.overflow = "";
|
||||
});
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=/assets/header.js.map
|
||||
Reference in New Issue
Block a user