不同页面点击添加class

 $(".scrollMenuItem a").each(function() {
    var _this = $(this);
    if (window.location.href.indexOf(_this.attr('href')) > -1) {
    _this.addClass("active").siblings().removeClass("active");
    };
});

 

posted @ 2022-02-25 10:41  吃惊夜夜  阅读(34)  评论(0编辑  收藏  举报