Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.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
Html 修正了IE上的菜单移动_Html_Css_Internet Explorer - Fatal编程技术网

Html 修正了IE上的菜单移动

Html 修正了IE上的菜单移动,html,css,internet-explorer,Html,Css,Internet Explorer,我创建了一个固定垂直菜单,并使用以下方法对其进行了固定: #main-menu { position: fixed; left: 0; top: 50px; } 在Chrome和Firefox上运行良好。但在IE(11、10、9)上,当页面滚动时,菜单会移动(抖动) 我在JSFIDLE中重现了这个问题:这是由IE的平滑滚动功能引起的,该功能为IE11的所有windows 8用户启用。您可以通过转到Internet选项、高级和取消选中使用平滑滚动来测试它。它解决了这个问题。但你网站的

我创建了一个固定垂直菜单,并使用以下方法对其进行了固定:

#main-menu {
  position: fixed;
  left: 0;
  top: 50px;
}
在Chrome和Firefox上运行良好。但在IE(11、10、9)上,当页面滚动时,菜单会移动(抖动)


我在JSFIDLE中重现了这个问题:

这是由IE的平滑滚动功能引起的,该功能为IE11的所有windows 8用户启用。您可以通过转到Internet选项、高级和取消选中使用平滑滚动来测试它。它解决了这个问题。但你网站的所有用户都不会这么做。下面是决议

这是一个js修复程序


它在IE 11中工作正常。@Alek但是当你滚动页面时,它一点也不摇晃?不,它工作正常:)很可能你的实际页面中有其他东西引起了刺耳的声音。使用UI响应工具可以更好地了解导致渲染问题的原因。
if(navigator.userAgent.match(/Trident\/7\./)) {
    $('body').on("mousewheel", function () {
        event.preventDefault();
        var wd = event.wheelDelta;
        var csp = window.pageYOffset;
        window.scrollTo(0, csp - wd);
    });
}