Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 单页站点导航闪烁(Chrome)_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 单页站点导航闪烁(Chrome)

Javascript 单页站点导航闪烁(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 {

向下滚动时,我的网站导航会闪烁

但只要你按下导航或打开inspect元素上的一个链接,网站就会很好地滚动

该网站的链接是github repo,仅供参考

问题似乎在于css,因为更改JavaScript没有任何效果,特别是以下代码:

编辑:这似乎只是chrome的问题

CSS

 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中没有闪烁。