Title: Doesnt close menu
Last modified: August 14, 2018

---

# Doesnt close menu

 *  Resolved [coroleu](https://wordpress.org/support/users/coroleu/)
 * (@coroleu)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/doesnt-close-menu/)
 * Hi, im using a template with your own “scroll-to” option but doesnt like me. 
   For this reason im use your plugin for some menu items. The problem is in mobile,
   when i click on “ordena en linea” menu item, the scroll works fine but menu doesnt
   close and if i try to close manually the scroll come back to top of the page.
   Im sorry for my bad english.
    Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdoesnt-close-menu%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/doesnt-close-menu/#post-10590883)
 * Hi,
 * The plugin cannot close a menu from a different script automatically. You’ll 
   need to add some custom javascript in your theme/template.
 * For example, try adding the script below in your theme’s footer.php just before
   the closing body tag (`</body>`):
 *     ```
       <script>
       (function($){
         $(window).on("load",function(){
           $(".mobile-sidebar .menu-item ._mPS2id-h").on("click",function(){
             $(".mfp-close").click();
           });
         });
       })(jQuery);
       </script>
       ```
   
 * This should do what you need.
 * Let me know if it works
 *  Thread Starter [coroleu](https://wordpress.org/support/users/coroleu/)
 * (@coroleu)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/doesnt-close-menu/#post-10591235)
 * Hi Malihu, thanks for your answer but doesnt work.
 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/doesnt-close-menu/#post-10591894)
 * Move the script below `wp_footer()` function in a new line just before the closing
   body tag. Is this possible?
 * If not, try changing the script to:
 *     ```
       <script>
       (function($){
         $(window).on("load",function(){
           $(".mobile-sidebar .menu-item").on("click","._mPS2id-h",function(){
             $(".mfp-close").click();
           });
         });
       })(jQuery);
       </script>
       ```
   
 *  Thread Starter [coroleu](https://wordpress.org/support/users/coroleu/)
 * (@coroleu)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/doesnt-close-menu/#post-10593146)
 * Yes, you right. I put the code manually in my child theme just before close the
   body tag and works great. Thanks a lot.
 *  Plugin Author [malihu](https://wordpress.org/support/users/malihu/)
 * (@malihu)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/doesnt-close-menu/#post-10596563)
 * Cool ☺️
    You’re welcome

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Doesnt close menu’ is closed to new replies.

 * ![](https://ps.w.org/page-scroll-to-id/assets/icon-256x256.png?rev=1401043)
 * [Page scroll to id](https://wordpress.org/plugins/page-scroll-to-id/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/page-scroll-to-id/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/page-scroll-to-id/)
 * [Active Topics](https://wordpress.org/support/plugin/page-scroll-to-id/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/page-scroll-to-id/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/page-scroll-to-id/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [malihu](https://wordpress.org/support/users/malihu/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/doesnt-close-menu/#post-10596563)
 * Status: resolved