-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (29 loc) · 843 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
let cont = document.getElementById("contactbox");
function setup() {
cont.style.display = "block";
}
function closediv() {
cont.style.display = "none";
}
let sourcetext = document.getElementById("closevw");
setTimeout(function closeview() {
sourcetext.style.display = "block";
}, 9000);
function closesource() {
sourcetext.style.display = "none";
}
// div animation
function reveal() {
let reveals = document.querySelectorAll(".reveal");
for (let i = 0; i < reveals.length; i++) {
let windowHeight = window.innerHeight;
let elementTop = reveals[i].getBoundingClientRect().top;
let elementVisible = 15;
if (elementTop < windowHeight - elementVisible) {
reveals[i].classList.add("active");
} else {
reveals[i].classList.remove("active");
}
}
}
window.addEventListener("scroll", reveal);