After searching for similar questions without success, I am turning to you for help. This is what I need:
When a user visits the "about" page, I want the li element to become active so that the CSS styles will apply. The same should happen when they click on "service," and so on.
Note 1: This menu is included in the main body using require_once("path/to/navmenu.php"), and I am not sure if this has any impact.
Note 2: I understand that jQuery is the solution here, but I have tried codes from similar questions on Stack Overflow with no luck. A JSFiddle demonstration would be greatly helpful.
HTML CODE:
<nav class="flexy-menu">
<li class="active"><a href="index.php">home</a><div class="menu-space"></div></li>
<li><a href="about-us-style1.php">about</a><div class="menu-space"></div></li>
<li><a href="service-style2.php">service</a><div class="menu-space"></div></li>
</nav>
CSS CODE:
.flexy-menu li:hover > a,
.flexy-menu li.active a {
background: #c68f50;
color: #fff;
}