I’m currently using the following code for my menu items:
HTML
<li>
<a id="About" class="button" href="About Us.cshtml">About Us</a>
</li>
<li style="margin-left: 30px;">
<a id="Services" class="button" href="Services.cshtml">Services</a>
</li>
<li style="margin-left: 30px;">
<a id="Contact" class="button" href="Contact Us.cshtml">Contact Us</a>
</li>
CSS
#About {background-image: url(../Buttons/About.png); width: 87px;}
#Services {background-image: url(../Buttons/Services.png); width: 112px;}
#Contact {background-image: url(../Buttons/Contact.png); width: 117px;}
a.button {height: 20px; display: inline-block; background-repeat: no-repeat}
a.button:hover {background-position: 0 -20px;}
a.button:active {background-position: 0 -40px;}
I need to get the buttons to remain in the ‘active’ state after they’re clicked and the page loads/refreshes etc.
If the solution requires javascript, please bear in mind that I’m a rank amateur so I’ll need any explanations in layman’s terms (preferably with examples).
You need to identify the page you are currently on.
If you’re not using jQuery replace this line:
with this line:
Hope this helps.