mirror of
https://github.com/vectras-team/as3.github.io.git
synced 2025-02-17 05:48:00 +00:00
17 lines
512 B
JavaScript
17 lines
512 B
JavaScript
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");
|
|
} else {
|
|
reveals[i].classList.remove("active");
|
|
}
|
|
}
|
|
}
|
|
|
|
window.addEventListener("scroll", reveal); |