简体   繁体   English

调整大小的 IE10 背景图像伪影

[英]IE10 Background Image Artifacts on Resize

I'm looking for some help or documentation around what I think is an IE10 render/repaint bug.我正在寻找有关我认为是 IE10 渲染/重绘错误的帮助或文档。

There is a content-containing element on a page.页面上有一个包含内容的元素。 It has a background image positioned to center bottom .它有一个位于center bottom的背景图像。 In the case of the build I am working on, the background image is dynamically injected by the CMS — hence the reprehensible inline style.在我正在处理的构建的情况下,背景图像是由 CMS 动态注入的——因此是应受谴责的内联样式。 Content exists on page load but is hidden;内容在页面加载时存在但被隐藏; to be revealed when the user expands an accordion-type UI element.当用户展开折叠式 UI 元素时显示。

<div class="background-element" style="background-image:url('http://placekitten.com/1500/100');">
    <div class="foreground-element">
        <div class="content">
            <h1>Some Content</h1>
            <p>Some filler copy. Some filler copy. Some filler copy.</p> 
        </div>
    </div>
</div>

JSFiddle Demo JSFiddle 演示

Initial State初始状态Expected, closed

The expected behavior is that, as the revealed content expands the container, the background image moves with the container.预期的行为是,随着显示的内容扩展容器,背景图像随容器移动。 This is how it works in most browsers.这就是它在大多数浏览器中的工作方式。

Expected Open State (after animation)预期打开状态(动画后)Expected, open

In IE10, though, the image is fractured along the border of the contained element, and repeated at intervals (directly related to the speed of the transition) in the container itself.但是,在 IE10 中,图像会沿着所包含元素的边界断裂,并在容器本身中间隔重复(与转换速度直接相关)。

IE10 Open State (after animation) IE10 打开状态(动画后)IE10, open

It looks like it may be related to Kingisback 's question, Background Image distortion in IE10 and moving the background with content flow?看起来它可能与Kingisback的问题有关, IE10 中的背景图像失真以及随内容流移动背景? but differs in that the background in this case is neither fixed nor set to cover so Shaheer 's answer doesn't apply.但不同之处在于,这种情况下的背景既不是fixed也不是设置为cover因此Shaheer的回答不适用。

Promote background-element to a new composite layer via CSS.通过 CSS 将background-element提升到新的复合层。

.background-element {
  transform: translateZ(0);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM