Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
rebeccashermy

The menu panel doesn't go away in Mobile mode

Question

Site URL: https://www.villanocoaching.com/

I designed a one-page website, the page will scroll down when you click the selected item in the top of the menu bar in desktop mode.
The Problem is that in mobile mode the menu panel doesn't go away due to the one-page design which won't reload the page. I did notice that the menu links while still scroll down to the desired content but the menu stays on screen. I would like the menu to disappear after the link has been selected. 

This is the code that I'm using:

<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
 <script type="text/javascript">
      $(function() {
        $('a[href*=#]:not([href=#])').click(function() {
          if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
            var target = $(this.hash);
            target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
            if (target.length) {
              $('html,body').animate({
                scrollTop: target.offset().top
              }, 1000);
              return false;
            }
          }
        });
      });
    </script>

This code lives in the header under Settings>Advance>Code Injection. TIA.

Share this post


Link to post

1 answer to this question

Recommended Posts

  • 0

I see fine here. Did you solve the problem? Can you share the solution for other members? Thank you.


You can send your question to my email to get faster answer. / How to Setup Password & Share URL 

-- I'm Tuan. I work for a non-profit project (build free libraries). I check the forum once or twice a day to help out the community. If you don't see me answering your question, you can send it to the email above. There are so many questions every day so I can't answer them all at once, I will try to answer them in the next few days.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...