JQuery Script to highlight current page’s navigation link


This is a small script used for highlighting the current page’s navigation link. Here you can also specify the scope by just removing “*” with your own expression. Here I am adding class “current” to the navigation link wich can be used for styling the link.

$("*").find("a[href='"+window.location.href+"']").each(function(){
$(this).addClass("current")
//add your own logic here if needed
})

,

  1. No comments yet.
(will not be published)
  1. No trackbacks yet.