2017-04-26 49 views
0

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

<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

回答

1

試試這個:

.Scroll a, a:hover, a:visited, a:link, a:active { 
    color: #FFFFFF; 
    text-decoration: none; 
} 

text-decoration: none;應該做的伎倆,並刪除下劃線。如果仍然無法正常工作添加!importanttext-decoration這樣後:text-decoration: none !important;

+1

謝謝你用這個和它現在的工作。 – Desinneh

+0

我很高興它的工作! :) –

0

試試這個,改變顏色和刪除文本裝飾的代碼有直接在標籤是

a{ 
    text-decoration: none; 
    color: inherit; 
} 
0

設置你的CSS來

a:visited {text-decoration:none;白顏色; }

你可以改變顏色,以任何你想要的顏色。文字修飾不會刪除下劃線。

相關問題