Jquery / Javascript Solution for URL matches Href then add a Class
<script>
jQuery(document).ready( function($){
var url = window.location.href;
$('.service_list a').each(function(){
var href = $(this).attr('href');
if (url.indexOf(href) > -1) {
// alert("Yes!");
$(this).addClass("active");
}
});
});
</script>
Comments
Post a Comment