yuzu-emu.github.io/src/js/hero.js
James b35b12d04c Misc. changes (#3)
* Implement dynamic jumbotron

* Implement scrolling to about section
2018-01-13 22:28:31 -05:00

19 lines
777 B
JavaScript

const navbar = document.getElementById('hero-navbar');
const navbarBaseColor = 'is-dark';
if (navbar) {
window.addEventListener('scroll', () => {
if (window.scrollY > 0) {
navbar.classList.add('is-freestanding');
navbar.classList.add(navbarBaseColor);
} else {
navbar.classList.remove('is-freestanding');
navbar.classList.remove(navbarBaseColor);
}
});
}
// Handle random switch colors
const colors = ["orangered", "deepskyblue", "yellow", "deeppink", "lime", "gray"];
document.getElementById('LeftJoy').classList.add("switch-" + colors[Math.floor(Math.random() * colors.length)]);
document.getElementById('RightJoy').classList.add("switch-" + colors[Math.floor(Math.random() * colors.length)]);