2024-10-20 07:53:43 +00:00
|
|
|
const menuIcon = document.querySelector(".menu-icon");
|
|
|
|
const menuList = document.querySelector("nav");
|
|
|
|
const hamburgerIcon = document.querySelector(".fa-solid");
|
|
|
|
|
|
|
|
menuIcon.addEventListener("click", () => {
|
|
|
|
if (hamburgerIcon.classList[1] === "fa-bars") {
|
|
|
|
hamburgerIcon.classList.add("fa-xmark");
|
|
|
|
hamburgerIcon.classList.remove("fa-bars");
|
|
|
|
menuList.style.display = "block";
|
|
|
|
} else {
|
|
|
|
hamburgerIcon.classList.add("fa-bars");
|
|
|
|
hamburgerIcon.classList.remove("fa-xmark");
|
|
|
|
menuList.style.display = "none";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Tlačítko go to top
|
|
|
|
// Zobrazení tlačítka od rolovaní části stránky (víc logické než až na konci)
|
|
|
|
window.onscroll = function () {
|
|
|
|
scrollFunction();
|
|
|
|
};
|
|
|
|
|
|
|
|
function scrollFunction() {
|
|
|
|
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
|
|
|
|
document.getElementById("scrollToTopBtn").style.display = "block";
|
|
|
|
} else {
|
|
|
|
document.getElementById("scrollToTopBtn").style.display = "none";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Posunout nahoru, když uživatel klikne na tlačítko
|
|
|
|
function scrollToTop() {
|
|
|
|
document.body.scrollTop = 0; // Pro Safari
|
|
|
|
document.documentElement.scrollTop = 0; // Pro ostatní prohlížeče
|
|
|
|
}
|
2024-10-21 16:08:37 +00:00
|
|
|
// Code-box
|
|
|
|
|