I've created a dynamic "side-navigation" feature that can be hidden and shown (sliding from the right) by clicking on a specific icon. The functionality is implemented using an onclick function. Now, I'm looking to add a feature that allows the menu to close when users click anywhere outside of the div.
Here's my current code:
function show(){
document.getElementById('menu-layout').classList.add('active')
document.body.style.backgroundColor = "#7F7F7F";
};
function hide(){
document.getElementById('menu-layout').classList.remove('active')
document.body.style.backgroundColor = "white";
}