guichet/static/javascript/burger.js
2023-07-21 15:40:14 +02:00

20 lines
484 B
JavaScript

window.addEventListener(
"pagehide",
(event) => {
if (document.getElementById('menu-checkbox')) {
if (document.getElementById('menu-checkbox').checked) {
localStorage.setItem('menuopen', true);
} else {
localStorage.removeItem('menuopen');
}
}
},
false,
);
if (document.getElementById('menu-checkbox')) {
if (localStorage.getItem('menuopen')) {
document.getElementById('menu-checkbox').checked=true;
}
}