admin管理员组

文章数量:1122826

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.

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.

Share Improve this question asked Sep 21, 2017 at 12:57 user128312user128312 1
Add a comment  | 

1 Answer 1

Reset to default 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.

本文标签: Active menu item state on all menu items