varemenos
1/28/2012 - 2:21 AM

jQuery - find current page

jQuery - find current page

var url = window.location.href;
url = url.substr(url.lastIndexOf("/") + 1);
$("#nav").find("a[href='" + url + "']").addClass("current");
if(url == ''){
	$("#nav").find("a[href='index.php']").addClass("current");
}