1

this is my js to open and close sidenav with id="mySidenav".

 function openNav() {
  document.getElementById("mySidenav").style.width = "250px";
}

function closeNav() {
  document.getElementById("mySidenav").style.width = "0";
}

How to close the sidenav on clicking outside the sidenav and also when screen size is >600px?

  • 1
    Duplicate: [How do I detect a click outside an element?](https://stackoverflow.com/questions/152975/how-do-i-detect-a-click-outside-an-element) –  Feb 27 '22 at 12:40

0 Answers0