Menu Item active depending on the page
Sun Aug 01 2021 18:27:56 GMT+0000 (Coordinated Universal Time)
Saved by
@grivera12
#javascript
<script>
$(function() {
var loc = window.location.href; // returns the full URL
if(/about-us.html/.test(loc)) {
$('#lihome').removeClass('current');
$('#liabout').addClass('current');
}
if(/services.html/.test(loc)) {
$('#lihome').removeClass('current');
$('#liservices').addClass('current');
}
if(/our-work.html/.test(loc)) {
$('#lihome').removeClass('current');
$('#liwork').addClass('current');
}
if(/contact-us.html/.test(loc)) {
$('#lihome').removeClass('current');
$('#licontact').addClass('current');
}
});
</script>
content_copyCOPY
Add before the closing body tag. Change menu items' values accordingly. Set the homepage with the class="current" by default.
http://ojodata.com/webs/nmhroofing/index.html
Comments