• Resolved neuhaus3000

    (@neuhaus3000)


    Hello everyone,

    How could I make a button active ( with an active class ) when I’m in the section?

    For example, I could have this class on my button :
    #menu-item-17 a:hover {
    background-color:#990000;
    }

    But what can I do to make it stay red when I’m in the section?

    Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    A button in the navigation menu?

    Thread Starter neuhaus3000

    (@neuhaus3000)

    Yes ! ??

    Thread Starter neuhaus3000

    (@neuhaus3000)

    I have added this line in my theme for the menu.
    <?php wp_nav_menu( array( ‘sort_column’ => ‘menu_order’, ‘container_class’ => ‘menu-header’ ) ); ?>

    So I don’t have control over each button… ??

    Thanks again!

    neuhaus3000

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you open your webpage in Google Chrome?

    Thread Starter neuhaus3000

    (@neuhaus3000)

    Yep!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Right click on the menu and select ‘Inspect element’.
    You should see a new toolbar appear; exampled.

    Look at the HTML.
    As you’re using the wp_nav_menu function, you should see a class on a menu item that indicates it is selected. A class named ‘current_menu_item’ or similar.

    Do you see that? If so, use that class to identify a selected button.

    Thread Starter neuhaus3000

    (@neuhaus3000)

    Thank you so much!!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to make button active state?’ is closed to new replies.