title: how to close mobile navigation menu on click outside sidenav menu
body: <p>this is my js to open and close sidenav with id=&quot;mySidenav&quot;.</p>
  <pre><code> function openNav() {
    document.getElementById(&quot;mySidenav&quot;).style.width = &quot;250px&quot;;
  }
  
  function closeNav() {
    document.getElementById(&quot;mySidenav&quot;).style.width = &quot;0&quot;;
  }
  </code></pre>
  <p>How to close the sidenav on clicking outside the sidenav and also when screen size is &gt;600px?</p>