title: Close off-canvas mobile menu when link is clicked (JS)
body: <p>I have a mobile menu that has some anchored links that scroll to a certain section of the page when clicked. The problem with this is when I click one of these links, due to the fact that a new page is not loading, the menu remains open.</p>
  
  <p>I wish to implement a solution whereby if one of these links are clicked, the menu closes by default. I have tried to hide the menu on click using JS but I think my logic may be wrong. Any help would be great.</p>
  
  <p>Here is the code for my menu.</p>
  
  <pre><code>&lt;div id="my-id" class="uk-offcanvas custom_canvas"&gt;
     &lt;div class="uk-offcanvas-bar"&gt;
        &lt;div class="uk-panel"&gt;
           &lt;a class="btn btn primary remove_image-div" onclick="UIkit.offcanvas.hide([force = false]);"&gt; 
              &lt;img src="img/remove_icon.png" class="remove_image" alt="remove"&gt;
           &lt;/a&gt;
           &lt;ul class="mm-list mm-panel mm-opened mm-subopened" id="mm-0"&gt;
              &lt;li class="offcanvas_li"&gt;
                 &lt;a class="offcanvas_open" title="Samples" href="index.html#sample-section"&gt;Samples&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="offcanvas_li"&gt;
                 &lt;a href="index.html#package-section" title="Packages" class="offcanvas_open"&gt;Packages&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="offcanvas_li"&gt;
                 &lt;a href="#about-section" title="About" class="offcanvas_open"&gt;About&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="offcanvas_li"&gt;
                 &lt;a href="contact.html" title="Contact" class="offcanvas_open"&gt;Contact&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="offcanvas_li"&gt;
                 &lt;a href="blog.html" title="Blog" class="offcanvas_open"&gt;Blog&lt;/a&gt;
              &lt;/li&gt;
              &lt;li class="offcanvas_li"&gt;
                 &lt;a class="offcanvas_open" title="We Love" href="we_love.html"&gt;We Love&lt;/a&gt;
             &lt;/li&gt; 
          &lt;/ul&gt;
       &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>