mirror of
https://github.com/yuzu-emu/yuzu-emu.github.io.git
synced 2024-12-02 13:14: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 navbarBaseColor = 'is-dark';
|
||||
|
||||
if (navbar) {
|
||||
window.addEventListener('scroll', () => {
|
||||
window.addEventListener('scroll', () => {
|
||||
if (window.scrollY > 0) {
|
||||
navbar.classList.add('is-freestanding');
|
||||
navbar.classList.add(navbarBaseColor);
|
||||
@ -14,6 +15,14 @@ if (navbar) {
|
||||
}
|
||||
|
||||
// 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)]);
|
||||
const leftJoycon = document.getElementById('LeftJoy');
|
||||
const rightJoycon = document.getElementById('RightJoy');
|
||||
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