[JS]How to set a navigation hight light dynamic

2017-1-25 写技术

How to set a navigation hight light dynamic?

There is a javascript solution:

	var url = window.location.pathname + window.location.search;
	url = url.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)|(\/(group)\/\d+)|(&group=\d+)/, "");
	$(".sNav").find("a[href='" + url + "']").parent().addClass("cur");	
 

标签: JS

发表评论:

Powered by anycle 湘ICP备15001973号-1