Forums

drop down menu that drops on click (2 posts)

  1. masiniambalare
    Member
    Posted 8 months ago #

    hi guys, i would like to make a drop down menu that drops only on click. when you click parent also list children. for example A with children A1,A2,A3 and B with children B1,B2

    initial :
    A
    B
    after you click A
    A
    A1
    A2
    A3
    B

  2. wearitwell
    Member
    Posted 8 months ago #

    You can do that by using css.

    Depending on your menu structure, you can use the .current-page-item class to hide or show children.

    If A is not clicked, it DOESN'T have the .current-page-item class. So you could do something like

    li.page_item ul.children {
        display: none;
        visibility: hidden;
    }

    That hides the children of regular page items.

    After you have clicked A, it has the class .current-page-item. Then you can do this

    li.current_page_item ul.children {
        display: block;
        visibility: visible;
    }

    It will show children of the current page, while children of other pages are hidden.

    This code came straight from twentyten. You might not have the class .children for the subpages if you are using a different theme. Then you would have to do it in a different way...
    Good luck
    Anja

Reply

You must log in to post.

About this Topic