IE 10、11下cssfixed固定的背景在鼠标滚轮滚动时跳动解决方法

I know it is a bit late for an answer but I've had the same problem and was able to fix it by adding these attributes to my css file.

html{
    overflow: hidden;
    height: 100%;    
}
body{
    overflow: auto;
    height: 100%;
}

 上面方法可能造成页面问题,可用下面代码解决

<script>
if(!!window.ActiveXObject || "ActiveXObject" in window){
  document.body.addEventListener && document.body.addEventListener("mousewheel", function () {
      event.preventDefault();
      var wd = event['wheelDelta'];
      var csp = window.pageYOffset;
      window.scrollTo(0, csp - wd);
    },{ passive: true });
}
</script>

  

posted on 2021-03-12 21:22  剩余价值  阅读(207)  评论(1编辑  收藏  举报

导航