Add text animation

This commit is contained in:
2022-08-31 20:52:46 +02:00
parent 411feef7c6
commit 1544841637
2 changed files with 46 additions and 2 deletions

View File

@ -1,4 +1,20 @@
//Init
function reveal() {
var reveals = document.querySelectorAll(".reveal");
for (var i = 0; i < reveals.length; i++) {
var windowHeight = window.innerHeight;
var elementTop = reveals[i].getBoundingClientRect().top;
var elementVisible = 150;
if (elementTop < windowHeight - elementVisible) {
reveals[i].classList.add("active");
}
}
}
window.addEventListener("scroll", reveal);
$(document).ready(function(){
init();
});
@ -49,4 +65,7 @@
$(window).scroll(function () {
$(this).scrollTop() > 50 ? $('#scroll').fadeOut() : $('#scroll').fadeIn()
});
}
}