Keep fixing sidebar
This commit is contained in:
parent
a56cfba95c
commit
d02b9f0c74
1 changed files with 14 additions and 2 deletions
|
@ -1,9 +1,21 @@
|
||||||
function checkWidth() {
|
function checkWidth() {
|
||||||
if (!window.matchMedia('(max-device-width: 768px)').matches) {
|
let navmenu = document.getElementById("nav-menu");
|
||||||
document.getElementById("nav-menu").open = true;
|
|
||||||
|
// 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() {
|
window.onresize = function() {
|
||||||
checkWidth();
|
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;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue