a标签点击页面刷新但还保存当前点击的class是激活的状态

 $(".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")
           }
          
        })

posted @ 2018-04-04 17:09  smile!!  阅读(748)  评论(0编辑  收藏  举报