-
Notifications
You must be signed in to change notification settings - Fork 21
/
main.js
48 lines (37 loc) · 1.21 KB
/
main.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
38
39
40
41
42
43
44
45
46
47
48
const parallax = document.getElementById("home-img-lg");
const parallax1 = document.getElementById("parallax1");
const parallax2 = document.getElementById("parallax2");
window.addEventListener("scroll", function()
{
let offset = window.pageYOffset;
parallax.style.backgroundPositionX = offset*(-0.3)-100 + "px";
})
window.addEventListener("scroll", function()
{
let offset = window.pageYOffset;
offset-=3100;
parallax1.style.backgroundPositionY = offset*(0.1) + "px";
})
window.addEventListener("scroll", function()
{
let offset = window.pageYOffset;
offset-=4800;
parallax2.style.backgroundPositionY = offset*(-0.1) + "px";
})
function myFunction() {
document.getElementById("check").checked = false;
}
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);