Animate entire menu slowly for totally collapsed mobile style?

Home Forums Older releases 0.9.x Animate entire menu slowly for totally collapsed mobile style?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2346
    oldgit
    Participant

    Is it possible to have entire menu animate down slowly for a totally collapsed mobile style?

    I used the “Adding a menu toggle button on small screens” code but I couldn’t control the slide down speed – it just seemed to toggle on and off

    Thanks

    #2348
    admin
    Keymaster

    Yes, you will need to use a slightly modified version of the JS code – for example, something like this:

    $(function() {
      $('#menu-button').click(function() {
        var $this = $(this),
            $menu = $('#main-menu');
        if (!$this.hasClass('collapsed')) {
          if (!$menu.hasClass('collapsed')) {
            $menu.slideUp(250, function() { $(this).addClass('collapsed').css('display', ''); });
          }
          $this.addClass('collapsed');
        } else {
          $menu.slideDown(250, function() { $(this).removeClass('collapsed'); });
          $this.removeClass('collapsed');
        }
        return false;
      }).click();
    });
    #2349
    oldgit
    Participant

    Thank you very much- perfect – you really know your JS inside out!
    May I suggest you include this functionality as an init option in next version – would make your menu all conquering!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Register

You will be emailed a link to set your password.

Login

Lost password?