js header

This commit is contained in:
ouidade 2024-07-06 21:51:11 +02:00
parent 72c2c9ff59
commit 46c3afcd53
4 changed files with 21 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -371,6 +371,9 @@ header .header_nav_container.hidden {
header .header_nav_container.visible { header .header_nav_container.visible {
transform: translateX(0); transform: translateX(0);
} }
header .header:hover + .header_nav_container {
transform: translateX(0);
}
footer { footer {
z-index: 100; z-index: 100;

View File

@ -38,6 +38,8 @@
}); });
//////// header //////////// //////// header ////////////
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
const headerNavContainer = document.querySelector('.header_nav_container'); const headerNavContainer = document.querySelector('.header_nav_container');
let lastScrollTop = 0; let lastScrollTop = 0;
@ -81,6 +83,18 @@
window.addEventListener('scroll', function() { window.addEventListener('scroll', function() {
handleScroll(); handleScroll();
}); });
const headerLeftContainer = document.querySelector('header');
headerLeftContainer.addEventListener('mouseenter', function() {
slideIn(); // Slide out on mouse enter
});
headerLeftContainer.addEventListener('mouseleave', function() {
if (lastScrollTop <= threshold) {
slideOut(); // Slide in on mouse leave if not scrolled down
}
});
}); });

View File

@ -160,4 +160,7 @@ header{
transform: translateX(0); transform: translateX(0);
} }
.header:hover + .header_nav_container {
transform: translateX(0);
}
} }