2017-04-26 66 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;白颜色; }

你可以改变颜色,以任何你想要的颜色。文字修饰不会删除下划线。

相关问题