mirror of
https://github.com/yuzu-emu/yuzu-emu.github.io.git
synced 2024-12-03 13:44:21 +01:00
Fixed NULL reference exceptions on joycon switching.
This commit is contained in:
parent
071715207e
commit
a1808243a6
@ -1,8 +1,9 @@
|
|||||||
|
// Hero navbar fades to the normal navbar color once scrolled.
|
||||||
const navbar = document.getElementById('hero-navbar');
|
const navbar = document.getElementById('hero-navbar');
|
||||||
const navbarBaseColor = 'is-dark';
|
const navbarBaseColor = 'is-dark';
|
||||||
|
|
||||||
if (navbar) {
|
if (navbar) {
|
||||||
window.addEventListener('scroll', () => {
|
window.addEventListener('scroll', () => {
|
||||||
if (window.scrollY > 0) {
|
if (window.scrollY > 0) {
|
||||||
navbar.classList.add('is-freestanding');
|
navbar.classList.add('is-freestanding');
|
||||||
navbar.classList.add(navbarBaseColor);
|
navbar.classList.add(navbarBaseColor);
|
||||||
@ -14,6 +15,14 @@ if (navbar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle random switch colors
|
// Handle random switch colors
|
||||||
const colors = ["orangered", "deepskyblue", "yellow", "deeppink", "lime", "gray"];
|
const leftJoycon = document.getElementById('LeftJoy');
|
||||||
document.getElementById('LeftJoy').classList.add("switch-" + colors[Math.floor(Math.random() * colors.length)]);
|
const rightJoycon = document.getElementById('RightJoy');
|
||||||
document.getElementById('RightJoy').classList.add("switch-" + colors[Math.floor(Math.random() * colors.length)]);
|
const colors = ['orangered', 'deepskyblue', 'yellow', 'deeppink', 'lime', 'gray'];
|
||||||
|
|
||||||
|
if (leftJoycon) {
|
||||||
|
leftJoycon.classList.add('switch-' + colors[Math.floor(Math.random() * colors.length)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rightJoycon) {
|
||||||
|
rightJoycon.classList.add('switch-' + colors[Math.floor(Math.random() * colors.length)]);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user