• Resolved robsarna

    (@robsarna)


    Hi.

    First off, great plugin… really useful!

    I have a site that has a long page using anchor links in the menu.

    What i need to do is, when a menu item is clicked in the shiftnav menu, i need the menu to close (as the page scrolls down to the correct anchor section)

    Hope that makes sense, any help you could give me will be much appreciated!

    Thanks

    Rob

    https://wordpress.org/plugins/shiftnav-responsive-mobile-menu/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author sevenspark

    (@sevenspark)

    Hi Rob,

    Thanks, glad you’re enjoying the plugin! 🙂

    What I would do is use the ShiftNav Javascript API to close the menu on click. Something along the lines of

    jQuery( document ).ready( function( $ ){
      $( '.shiftnav .menu-item' ).on( 'click' , function(){
        $( '.shiftnav' ).shiftnav( 'closeShiftNav' );
      });
    });

    Hope that helps! 🙂

    Chris

    Thread Starter robsarna

    (@robsarna)

    Thanks Chris,

    You are a lifesaver!

    The code that ended up working for me (incase anyone else needs) was:

    <script type="text/javascript">
     jQuery( '.shiftnav-target' ).on( 'click' , function(){
     jQuery( '.shiftnav' ).shiftnav( 'closeShiftNav' );
      });
    </script>

    Chris – send me your paypal, i owe you a beer! (or ill just buy the premium one!)

    Rob

    Plugin Author sevenspark

    (@sevenspark)

    You’re welcome, Rob, glad it helped! 🙂

    Donation link is here: http://bit.ly/bVogDN

    But the the Pro version is an even better deal as you get a bunch of advanced options 🙂 Totally up to you, and not necessary either way.

    Take care! 🙂

    Chris

    Hi guys,

    I think i’m being really stupid but where is the Javascript API?

    Where exactly do I enter that code?

    Thanks
    Tom

    Plugin Author sevenspark

    (@sevenspark)

    The code would go in a custom javascript file (discussed further in a Pro support ticket)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Close menu on item click’ is closed to new replies.