I have this "problem" with my website that is, when i am at the Home Page i have another link of my menu that is not a page, who stays active because i used an anchor on that link.
Basicaly i added the https://dama.ci/notre-histoire url to that link so when i’m on another page of my website i can actually click on the link and go back to the home page where the anchor is attached and this is what causes the problem.
So my question is, since that link on the menu isn’t a page what could i actually do to have the link activated only when it’s clicked ?
Is there another way to achieve what i’m trying to have on the website ?
If you want to check the site here is the URL
2
Answers
Change your “Services” link URL from:
https://dama.ci/#inspiration
to simply:
/#inspiration
i.e. remember to add your domain’s trailing slash when you use the full or root-relative URL in your links.
When you say two menu items get highlighted at the same time, you mean “inspiration” and “Home”? If yes, you’ll need to make the “Home” link point to the top of the homepage (e.g. with a URL like /#inspiration). Otherwise, it gets highlighted by your theme as the current page.
You can try with another way, you should remove current-menu-item class from that li onload using js i have added sample js code for you