IE 10& 11使用鼠标滚轮滚动时使固定背景跳跃 [英] IE 10 & 11 make fixed backgrounds jump when scrolling with mouse wheel

查看:117
本文介绍了IE 10& 11使用鼠标滚轮滚动时使固定背景跳跃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在Windows 8中使用鼠标滚轮滚动时,固定的背景图像会像疯狂一样弹跳。这只会影响IE 10和IE 11.这会影响 position:fixed 的元素。是否有防止它发生在IE 10和11?

When you scroll with the mouse wheel in Windows 8 the fixed background image bounces around like crazy. This only affects IE 10 and IE 11. This affects elements with position:fixed as well. Is there a prevent it to happen in IE 10 and 11?

这是一个固定的背景图像的例子:

Here is an example with a fixed background-image:

http://www.catcubed.com/test/bg-img -fixed.html

推荐答案

我知道答案有点晚了,问题,并能够通过添加这些属性到我的css文件中修复它。

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%;
}

从评论: b
$ b

From the comments:


此解决方案停止在窗口上触发滚动事件,因此,如果您使用依赖此类事件的任何事件,请小心。 codepen.io/anon/pen/VawZEV?editors=1111 (overflow:hidden ,滚动事件不起作用) codepen.io/anon/pen/PNoYXY?editors=1111 (overflow:auto,scroll events fire) - Dan Abrey

This solution stops scroll events from firing on the window, so do be careful if you're using anything that relies on such events firing. codepen.io/anon/pen/VawZEV?editors=1111 ( overflow: hidden, scroll events don't work) codepen.io/anon/pen/PNoYXY?editors=1111 ( overflow: auto, scroll events fire) - Dan Abrey

这可能会在您的项目中导致一些问题。但我没有看到另一种方法来解决IE中的这个错误。

So this might cause some problems in your projects. But I don't see another way to workaround this bug in IE.

这篇关于IE 10& 11使用鼠标滚轮滚动时使固定背景跳跃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆