点击标签跳转页面,且高亮显示

方法如下:

可以通过判断href的值 和 获取到的页面url链接是否一致,来解决

$('.Nabout_nav ul li a').each(function() {
      if ($($(this))[0].href == String(window.location)) {
          $('.Nabout_nav ul li').removeClass("current");
          $(this).parent().addClass('current');
      };
    });

猜你喜欢

转载自blog.csdn.net/dream0129/article/details/80177634