-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
28 lines (26 loc) · 1.1 KB
/
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
27
28
// Smooth scroll to the "How It Works" section when "Learn More" is clicked.
document.addEventListener("DOMContentLoaded", function () {
const learnMoreBtn = document.getElementById("learnMoreBtn");
if (learnMoreBtn) {
learnMoreBtn.addEventListener("click", function () {
document.getElementById("howItWorks").scrollIntoView({ behavior: "smooth" });
});
}
});
document.addEventListener("DOMContentLoaded", function () {
// Randomly position each collage logo on initial load
const logos = document.querySelectorAll('.collage-logo');
logos.forEach(function (logo) {
const randomTop = Math.random() * 100;
const randomLeft = Math.random() * 100;
logo.style.top = randomTop + '%';
logo.style.left = randomLeft + '%';
// Add an event listener to update position on each animation cycle
logo.addEventListener('animationiteration', function () {
const newRandomTop = Math.random() * 100;
const newRandomLeft = Math.random() * 100;
logo.style.top = newRandomTop + '%';
logo.style.left = newRandomLeft + '%';
});
});
});