Noch mehr super tolle Animationen die überhaupt gar kein Krebs waren zu implementieren und super toll aussehen und gar kein krebs waren zu implementieren :D
This commit is contained in:
@ -17,9 +17,36 @@
|
||||
animateElements();
|
||||
}
|
||||
|
||||
|
||||
function scrollToElement(elementId) {
|
||||
var element = document.getElementById(elementId);
|
||||
if (element) {
|
||||
element.scrollIntoView({ behavior: 'smooth' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function initHeroAreaScrollAnimation(scrollToElementId) {
|
||||
const heroArea = document.querySelector('.hero_area');
|
||||
const heroAreaHeight = heroArea.offsetHeight;
|
||||
const threshold = heroAreaHeight / 1.75;
|
||||
|
||||
function onScroll() {
|
||||
if (window.scrollY > threshold) {
|
||||
heroArea.classList.remove('hero-area-visible');
|
||||
heroArea.classList.add('hero-area-hidden');
|
||||
} else {
|
||||
heroArea.classList.remove('hero-area-hidden');
|
||||
heroArea.classList.add('hero-area-visible');
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('scroll', onScroll);
|
||||
|
||||
// Rückgabe einer Funktion zum Entfernen des Event-Listeners
|
||||
return () => {
|
||||
window.removeEventListener('scroll', onScroll);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user