重定向的页面导致 select 正确的活动页面出现问题

Page redirected is causing a problem to select the correct active page

我正在使用 Squarespace,将页面 "danieconz.com/about" 设置为我的主页,因此它被重定向到 "danielconz.com"。

我已经在页脚和一些 CSS 代码处创建了 link 页面。我的问题是,当我在 "danielconz.com" 时,这些 link 都被选中了。但是,只应选择 "About" link。

这是我正在使用的CSS:

    @media all and (max-width:750px) {
#footer h1 {
    width: 120px;
    margin: 0 auto;
    padding-bottom: 0px;
    line-height: 70px!important;
 }
#footer h1 .active-link {
  border-top: 2px solid #1a1611;
}
#footer h1 a:hover {
  border-top: 2px solid #1a1611;
}
}

@media all and (min-width:750px) {
#footer h1 a:hover {
  border-top: 2px solid #1a1611;
  padding: 0px !important;
}

#footer h1 .active-link  {
  border-top: 2px solid #1a1611;
  padding: 0px !important;
}
}

并在桌面和移动设备上关注问题的几个图像。有人可以帮我吗? 提前致谢。

desktop mobile

您有一个 javascript 将 link-active class 添加到页脚中的 link。

您可以快速将函数更改为此,请检查:

$(function() {
if(location.pathname.split("/")[1]==""){
    $('footer h1 a').removeClass('active-link');
    $('footer h1 a[href^="/about"]').addClass('active-link');
}else{
    $('footer h1 a[href^="/' + location.pathname.split("/")[1] + '"]').addClass('active-link');
}
$('body').addClass('enter');//This part is the same
});