Keep fixing sidebar

This commit is contained in:
Joshua Goins 2024-02-19 15:45:35 -05:00
parent a56cfba95c
commit d02b9f0c74

View file

@ -1,9 +1,21 @@
function checkWidth() {
if (!window.matchMedia('(max-device-width: 768px)').matches) {
document.getElementById("nav-menu").open = true;
let navmenu = document.getElementById("nav-menu");
// If the device somehow gains the stick sidebar, make sure it's open
if (window.matchMedia('(max-device-width: 768px)').matches) {
navmenu.open = true;
}
}
window.onresize = function() {
checkWidth();
};
checkWidth();
let navmenu = document.getElementById("nav-menu");
// Disable by default on mobile devices
if (window.matchMedia('(max-device-width: 768px)').matches) {
navmenu.open = false;
}