17 lines
523 B
JavaScript
17 lines
523 B
JavaScript
|
window.Sidebar = function () {
|
||
|
let sidebar = document.querySelector("#sidebar");
|
||
|
let close = document.querySelector("#sidebar-toggle-close");
|
||
|
let toggle = document.querySelector("#sidebar-toggle-input");
|
||
|
|
||
|
sidebar.addEventListener("click", function (event) {
|
||
|
if (document.body.clientWidth < 1280) {
|
||
|
toggle.checked = false;
|
||
|
}
|
||
|
})
|
||
|
|
||
|
close.addEventListener("click", function (event) {
|
||
|
if (document.body.clientWidth < 1280) {
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
})
|
||
|
}
|