[Resolved] Animating sub menu drop downs

Home Forums Support [Resolved] Animating sub menu drop downs

Home Forums Support Animating sub menu drop downs

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #551378
    Nick

    Hi,
    How would I go about animating the li’s within the .sub-menu ul, so that when clicked, their children slide out instead of appearing instantly?
    Thanks in advance for any help.

    #551751
    Leo
    Staff
    Customer Support

    Hi there,

    Any chance you can provide an example of what you would like to achieve?

    #552344
    Nick

    A bit like this, except that the same animations and functionality are happening within the top nav submenu, and the opening and closing is to be operated by the on click event instead of on hover: https://www.jqueryscript.net/demo/Animated-Multi-level-Dropdown-Side-Menu-with-jQuery-Tendina-Plugin/#

    As you can see, this example also closes the other open li when a new one is opened, so that there is only ever one open at a time. If you have any ideas on how to implement that functionality, that would be great as well.

    Thanks

    #552872
    Tom
    Lead Developer
    Lead Developer

    You could try something like this:

    .main-navigation .sub-menu {
        max-height: 0;
        transition: max-height 600ms ease-in-out;
    }
    
    .main-navigation .sub-menu.toggled-on {
        max-height: 500px;
    }

    Let me know ๐Ÿ™‚

    #555270
    Nick

    Hi,
    Thank you, yes this worked, with the exception of adding the following overflow setting to stop scrollbars appearing (they were appearing whether there was overflow or not), and raising the max height to stop any overflow:

    .main-navigation .sub-menu {
        max-height: 0;
        transition: max-height 300ms ease-in-out;
        overflow-y: hidden;
    }
    
    .main-navigation .sub-menu.toggled-on {
        max-height: 800px;
    }

    Much appreciated!

    #555347
    Tom
    Lead Developer
    Lead Developer

    Awesome, glad I could help! ๐Ÿ™‚

    #557684
    Fricis

    Hi,

    How to get it work for slide-out(mobile) menu?

    Thanks!

    #558119
    Tom
    Lead Developer
    Lead Developer
    #1649969
    Viktor

    Hi, I know this is an old thread but my question is the same – how to animate the drop-downs on the off-canvas mobile menu.
    The linked solution above doesn’t seem to work with the latest GP (Premium) version.

    #1650070
    David
    Staff
    Customer Support

    Hi there,

    that ‘should’ still work – if you want to raise a new topic where you can share a link to your site, i can take a look.

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