当您在 Windows 8 中滚动鼠标滚轮时,固定的背景图像会疯狂地弹跳。这仅影响 IE 10 和 IE 11。这会影响以下元素position:fixed
以及。
这是一个具有固定背景图像的示例:
http://www.catcubed.com/test/bg-img-fixed.html http://www.catcubed.com/test/bg-img-fixed.html
这是示例代码:
#section{
position: fixed;
top:0;
left:0;
background-color:#eee;
background-position: top left;
background-image: url("images/7.png");
background-size: auto;
background-repeat: no-repeat;
z-index: 10;
}
有没有办法让 IE 10 和 11 中的背景保持不变?
我知道现在回答有点晚了,但我也遇到了同样的问题,并且能够通过将这些属性添加到我的 css 文件中来修复它
html{
overflow: hidden;
height: 100%;
}
body{
overflow: auto;
height: 100%;
}
来自评论:
此解决方案会阻止滚动事件在窗口上触发,因此如果您使用任何依赖于此类事件触发的内容,请务必小心。codepen.io/anon/pen/VawZEV?editors=1111 http://codepen.io/anon/pen/VawZEV?editors=1111(溢出:隐藏,滚动事件不起作用)codepen.io/anon/pen/PNoYXY?editors=1111 http://codepen.io/anon/pen/PNoYXY?editors=1111(溢出:自动,滚动事件触发)- Dan Abrey
所以这可能会导致您的项目出现一些问题。但我没有看到其他方法来解决 IE 中的这个错误。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)