Close Mobile Slide Menu on Click

I was able to find an answer to this provided by @malihu, author of the page to scroll id plugin – as @malihu noted, I was using a one-page menu for my theme, and the function of click to scroll isn’t tied to a page. This code ties the menu action to the scroll and not only a page link.

Mobile menu not auto close on menu link @malihu

<script> 
(function($){
    $(window).on("load",function(){         $("body").on("click","#slide-mobile-menu .menu-item a[href*='#']",function(){$("#menu-toggle-close")[0].click();});     }); })(jQuery); </script>