$(".shop-list1").find("li").each(function(){
var href=$(this).attr("hrefs");
var hd1 = window.location.pathname;
var hd2 = window.location.search;
var href1=hd1+hd2;
var href2=href1.replace("/","");
if($(this).attr("hrefs")==href2){
$(this).addClass("active").sublings().removeClass("active")
}
})
转载于:https://www.cnblogs.com/huangjinmei/p/8718291.html