• Derar forum members,

    I have created a vertical menu using OceanWP which works almost perfectly.
    In order to keep the submenu open (and not collapse after clicking) I used this css I found in this forum.

    I would like to know if there’s a way to close the submenu you are in when clicking in other main-menu item. What happens now is that it stays open until you click in a new sub-menu.

    .current-page-ancestor>a,
    .current-menu-item >a {
        color: #07cab8 !important;
    }
    
    .current-page-parent>a{ color: initial !important;}
    
    #site-header.vertical-header #site-navigation-wrap .dropdown-menu 
    li.current-page-ancestor > .sub-menu {
        display: block !important;
    }

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    That is because of the below section of the code, kindly remove the below part from the above code and check.

    #site-header.vertical-header #site-navigation-wrap .dropdown-menu 
    li.current-page-ancestor > .sub-menu {
        display: block !important;
    }
    Thread Starter begoclaveria

    (@begoclaveria)

    Hello Abhishek,
    Thanks so much for your answer!

    I tried! but if I take I out it all collapses right after clicking. I’ll try to explain again, it’s difficult and my English is not so good..

    —-I have a menu built like this:
    Main-manu
    sub-menu
    sub-menu
    Main-manu
    sub-menu
    Main-manu
    sub-menu

    —- When all sub-menus are closed looks like this:
    Main-manu
    Main-manu
    Main-manu

    —-When I click first main-menu item + first sub-menu item does this:
    Main-manu
    sub-menu (and now we are here in this page)
    sub-menu
    Main-manu
    Main-manu

    —- HERE IS THE PROBLEM – When I click second main-menu item, does this:
    Main-manu
    sub-menu (since we are here in this page, it keeps open and doesn’t collapse)
    sub-menu
    Main-manu
    sub-menu
    Main-manu

    —-HERE IS THE PROBLEM – But I want it to do this.
    Main-manu (we are here, inside this main menu, but I still want it to collapse)
    Main-manu
    sub-menu
    Main-manu

    Hope it is understandable, and again, thank you so much for your help.

    Bego.

    Hello,

    It is possible, but unfortunately, it needs to write a complete Jquery code and it falls under Personal Customization, and as such is out of our scope: https://docs.oceanwp.org/article/685-support-policy

    Usually, when it comes only to a few lines of code, we are more than eager to help everyone achieve the desired look. However, this is really more than that, and I would kindly advise you to consult a professional on this matter.

    Hope this helps and best of luck with your website

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘vertical menu: Submenu not collapsing when clicking nee menu item’ is closed to new replies.