CrowdedGames.Group/script.js

27 lines
1.2 KiB
JavaScript

// If Javascript is enabled, enable the cool javascript stuff!
document.getElementsByClassName("WorkSection")[0].classList.add("HiddenToRight");
// Sounds for animations to feel nice :3
const Typing = new Audio("Audio/KeyboardTyping.mp3");
const Glow = new Audio("Audio/Glow.mp3");
setTimeout(() => {
Typing.play();
}, 1000);
setTimeout(() => {
Glow.play();
}, 3000);
// Allow the cat to work
const Noise = new Audio("Audio/Meow.mp3");
const Cat = document.getElementsByClassName("Cat")[0];
Cat.addEventListener("mouseover", (event) => {
Noise.play();
});
// set the size of the Glow (SectionSolid) to the proper height (CSS defaults it to 200vh
document.getElementsByClassName("SectionSolid")[0].style.minHeight = String(document.getElementsByTagName("html")[0].offsetHeight - 180) + "px";
// force the user to topside of the window.
window.scroll(0, 0);
// play some animations as soon as the user gets to that amount of scroll.
window.addEventListener("scroll", (event) => {
if (window.scrollY + 190 >= document.getElementsByClassName("ProjectSection")[0].clientHeight && !document.getElementsByClassName("WorkSection")[0].classList.contains("SlideInFromRight")) {
document.getElementsByClassName("WorkSection")[0].classList.add("SlideInFromRight");
}
});