因此,我编写的网站有一个主页,其中有一个跨度,允许您点击它,然后向下滚动到一个新的部分,滚动工作,并向下滚动,但如果我手动向上滚动备份文本显示为蓝色并加下划线。有什么办法可以阻止这种情况的发生。我正在编码单击链接时向下滚动的页面。它看起来是蓝色的点击后
<a class="Scroll" href="#section02"><span></span>Scroll</a>
这是我用过的HTML和新的部分有ID的section02。
$(function() {
$('a[href*=#]').on('click', function(e) {
e.preventDefault();
$('html, body').animate({ scrollTop:
$($(this).attr('href')).offset().top}, 500, 'linear');
});
});
这是使用的JS。
.Scroll {
position: absolute;
height: 20px;
z-index: 20;
display: inline-block;
color: #fff;
font : normal 400 20px/1 'Josefin Sans', sans-serif;
letter-spacing: .1em;
text-decoration: none;
transition: opacity .3s;
}
.Scroll::after{
position: absolute;
height: 20px;
z-index: 20;
display: inline-block;
color: #fff;
font : normal 400 20px/1 'Josefin Sans', sans-serif;
letter-spacing: .1em;
text-decoration: none;
transition: opacity .3s;
}
.Scroll:hover {
opacity: .5;
color: #fff;
text-decoration: none;
}
这是因为我认为这可能是因为我没有造型链接被点击之后,但问题仍然存在,虽然hover样式仍然有效,当滚动是蓝色的我已经使用了CSS。
What the scroll link looks like before.
And what it looks like after being pressed and manually scrolling up.
任何帮助apprecitated
谢谢你用这个和它现在的工作。 – Desinneh
我很高兴它的工作! :) –