I have made a "side-navigation" and I set it to hide and show(slide from right) by clicking the specific icon. I have made it with onclick function. Now I need to close this menu by clicking anywhere outside of the div that I want to close.
My code is
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";
}