-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
26 lines (22 loc) · 1012 Bytes
/
script.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
window.addEventListener("scroll", function () {
let scrolled = window.scrollY;
// Adjust the styles for each section based on the scroll position
document.getElementById(
"section1"
).style.backgroundColor = `rgba(0, 188, 212, ${1 - scrolled / 1000})`;
document.getElementById("section1").style.color = `rgba(255, 255, 255, ${
1 - scrolled / 1000
})`;
document.getElementById(
"section2"
).style.backgroundColor = `rgba(103, 58, 183, ${1 - scrolled / 1000})`;
document.getElementById("section2").style.color = `rgba(255, 255, 255, ${
1 - scrolled / 1000
})`;
// Add the fade-in-out class to the sections for the opacity effect
document.getElementById("section1").classList.add("fade-in-out");
document.getElementById("section2").classList.add("fade-in-out");
// Add the zoom-effect class to the sections for the zoom effect
document.getElementById("section1").classList.add("zoom-effect");
document.getElementById("section2").classList.add("zoom-effect");
});