Javascript 单页站点导航闪烁(Chrome)
向下滚动时,我的网站导航会闪烁 但只要你按下导航或打开inspect元素上的一个链接,网站就会很好地滚动 该网站的链接是github repo,仅供参考 问题似乎在于css,因为更改JavaScript没有任何效果,特别是以下代码: 编辑:这似乎只是chrome的问题 CSSJavascript 单页站点导航闪烁(Chrome),javascript,jquery,html,css,Javascript,Jquery,Html,Css,向下滚动时,我的网站导航会闪烁 但只要你按下导航或打开inspect元素上的一个链接,网站就会很好地滚动 该网站的链接是github repo,仅供参考 问题似乎在于css,因为更改JavaScript没有任何效果,特别是以下代码: 编辑:这似乎只是chrome的问题 CSS nav { position: fixed; width: 100%; text-align: center; z-index: 99; padding-top: 1vh; } nav a {
nav {
position: fixed;
width: 100%;
text-align: center;
z-index: 99;
padding-top: 1vh;
}
nav a {
font-size: 1.25em;
font-family: 'Source Sans Pro', Arial, sans-serif;
text-decoration: none;
display: inline;
margin: 0 1vw;
padding: 0 3vw 4px;
border-bottom: 2px solid
}
Javascript
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
它不是一个推广性的社交网站。它在JSFIDLE上运行良好。。。。如果你想要的话,它就在这里:老实说,我看不到任何闪烁的导航点击或尖叫(在FF 33.1中)我看到它在chrome v39和IE11上,当你在点击任何东西之前使用滚轮向下滚动时。似乎是chrome的问题,在Ubuntu的FF中没有闪烁。