squirrel/static/js/header.js

23 lines
698 B
JavaScript
Raw Permalink Normal View History

2021-02-25 21:23:58 +00:00
const logo = document.getElementById('logo');
const header = document.getElementById("header");
const menuIcon = document.getElementById("menu-icon");
const scrollHeaderListener = () => {
if (window.scrollY > 0) {
logo.className = "small-logo"
menuIcon.classList.add("small-icon")
} else {
logo.className = "logo"
menuIcon.classList.remove("small-icon")
}
};
window.addEventListener("scroll", scrollHeaderListener);
function unfoldHeader() {
var headerItems = document.getElementById("header-items");
if (headerItems.className === "header-items") {
headerItems.classList.add("responsive")
} else {
headerItems.classList.remove("responsive")
}
}