简体   繁体   English

滚动时如何从链接中删除“已访问”状态?

[英]How to remove the “visited” state from a link when I scroll?

I have a one-page landing page that scrolls to various sections when I click buttons in the menu. 我有一个一页的登录页面,当我单击菜单中的按钮时,该页面会滚动到各个部分。 ... ...

However, once I have clicked a button and then I manually scroll elsewhere on the page, the clicked button still has the "visited" pseudo-class. 但是,一旦我单击一个按钮然后我手动滚动页面上的其他位置,单击的按钮仍然具有“已访问”的伪类。 Its appearance doesn't match where I am on the page. 它的外观与我在页面上的位置不匹配。

Even when I manually scroll back to the top of the page the button still has the visited pseudo-class. 即使当我手动滚动回到页面顶部时,该按钮仍然具有访问的伪类。 I can't seem to override its appearance by giving it a regular class. 我似乎无法通过给它一个普通的类来覆盖它的外观。

I would like to remove that "visited" state the moment I begin to scroll manually. 我想在手动滚动的那一刻删除“访问”状态。 How can I do that? 我怎样才能做到这一点? Is it possible? 可能吗?

$(window).scroll(function(e) {
        $("#menu-front-page-menu li a")...(how?);
}
});

您应该以相同的方式设置链接和访问过的链接(使用CSS非常简单),并使用addClass手动管理“访问”样式,而不是依赖于:visited伪类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM