added listener to close user control

This commit is contained in:
Calum Mackervoy 2019-11-15 13:02:08 +00:00 committed by Jean-Baptiste Pasquier
parent f3381ba8da
commit bbc4a9356c

View File

@ -81,6 +81,12 @@ document.addEventListener('DOMContentLoaded', function (event) {
} }
}).catch(error => console.log(error)); }).catch(error => console.log(error));
// Document -> close menu
document.addEventListener("click", event => {
if (!event.target.closest('#user-controls')) {
let userControls = this.querySelector('#user-controls');
if (userControls) userControls.removeAttribute("open");
}
});
}); });