[Resolved] Slidout menu collapse on dropdown click

Home Forums Support [Resolved] Slidout menu collapse on dropdown click

Home Forums Support Slidout menu collapse on dropdown click

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1225966
    Christine

    Hi,

    In my website I would lke to have a functionality on mobile slide out menu like if I click the one drop down section it opens, when I click on second/any other drop down the previously opened dropdown should get collapsed.
    Please let me know how we can do it. This is for your reference. https://prnt.sc/rst7hj

    Regards

    #1226455
    Leo
    Staff
    Customer Support
    #1228227
    Christine

    Hi Leo, Thank you for your response. I have added this code in my website but i cannot see the difference. I have added as a hook in wp_head.

    <script>
        jQuery( document ).ready( function( $ ) {
            $( '.main-navigation ul ul li.menu-item-has-children > a' ).on( 'click', function() {
                $( this ).closest( 'li' ).siblings().removeClass( 'sfHover' ).find( '.sub-menu' ).removeClass( 'toggled-on' );
            } );
        } );
    </script>
    

    We are clicking on the arrow and checking this. If I click on Parent sub menu item then we will be redirected to a different page so we don’t need it there.

    Please visit blissfulweddingfeet.com.au/ and check by yourself once.

    Thanks

    #1228767
    Tom
    Lead Developer
    Lead Developer

    Can you try this instead?:

    <script>
        jQuery( document ).ready( function( $ ) {
            $( '.main-navigation ul ul li.menu-item-has-children > a > .dropdown-menu-toggle' ).on( 'click', function() {
                $( this ).closest( 'li' ).siblings().removeClass( 'sfHover' ).find( '.sub-menu' ).removeClass( 'toggled-on' );
            } );
        } );
    </script>
    #1259127
    Christine

    Hey This worked… Thanks….

    #1259883
    Tom
    Lead Developer
    Lead Developer

    No problem!

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