因此,我編寫的網站有一個主頁,其中有一個跨度,允許您點擊它,然後向下滾動到一個新的部分,滾動工作,並向下滾動,但如果我手動向上滾動備份文本顯示爲藍色並加下劃線。有什麼辦法可以阻止這種情況的發生。我正在編碼單擊鏈接時向下滾動的頁面。它看起來是藍色的點擊後
<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
我很高興它的工作! :) –