0

My homepage is type of onepage site and I've created menu with anchor links for it, where users can navigate through sections. When user is on subpage, for example listing of posts and clicks menu item he goes back to the specific section of the homepage.

My anchors look like this:

  • /
  • /#about
  • /#products

etc.

I'm using Bem_Menu_Walker for BEM class names.

Problem is - when I'm on the homepage all my links are set to the active state. Any ideas why and how to fix it?

Thanks.

1 Answer 1

0

Have you tried deactivating Bem_Menu_Walker to see if that resolves the problem?

I would suggest removing the plugin and instead either adjusting your CSS or adding class names through menu management. (Each menu item allows you to add a class, if that's all you need to achieve.) Or, create your own custom walker.

Since these are all anchors, you may need to write some JavaScript that adds an event listener to your menu. When a click/tap event occurs, the JS needs to remove the active class from whatever element it is on and add the active class to the clicked/tapped element.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.