当它们的容器变得可见时,我遇到了一些图像无法呈现的问题。我在下面转载了这个问题。在完整窗口中打开代码段时,您可以通过切换复选框来再现问题。
.wrapper {
max-height: 0;
overflow: hidden;
position: absolute;
transition: .2s all ease-out;
z-index: 100;
}
#checkControl:checked~ .wrapper {
max-height: 540px;
}
.anchor {
display: block;
}
.anchor img {
filter: grayscale(100%);
width: 60px;
}<input type="checkbox" id="checkControl">
<div class="wrapper">
<div class="problemDiv">
<a class="anchor">
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/feed.svg" >One
</a>
<a class="anchor">
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/feed.svg" >Two
</a>
<a class="anchor">
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/feed.svg">Three
</a>
<a class="anchor">
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/feed.svg">Four
</a>
<a class="anchor">
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/feed.svg">Five
</a>
<a class="anchor">
<img src="https://www.gstatic.com/images/icons/material/product/2x/pagespeed_64dp.png">Six
</a>
</div>
</div>
预期的行为:所有要显示的图像。
实际行为:只显示前几个。
我注意到的事物:
快速双击关闭开关,然后打开通常加载更多的图像。
在dev工具中更改样式将加载图像(甚至不相关的样式)
点击并移动鼠标,最终使其呈现。
删除.problemDiv元素修复了问题
移除过滤器:灰度(100%)样式解决了问题
其他吊架也能正常工作
有人能解释一下这里发生了什么来阻止图像的加载吗?我仍然有困难修复我的网站上的实际错误,因为我不能删除那个样式或包装元素。
发布于 2019-03-01 06:38:19
更新的JSFiddle
.wrapper {
max-height: 0;
overflow: hidden;
position: absolute;
transition: 2s all ease-out;
z-index: 100;
}
#checkControl:checked~.wrapper {
max-height: 540px;
}
.anchor {
display: block;
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
}
.anchor img {
width: 60px;
}<input type="checkbox" id="checkControl">
<div class="wrapper">
<div class="problemDiv">
<a class="anchor">
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/feed.svg" />One
</a>
<a class="anchor">
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/feed.svg" />Two
</a>
<a class="anchor">
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/feed.svg" />Three
</a>
<a class="anchor">
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/feed.svg" />Four
</a>
<a class="anchor">
<img src="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/feed.svg" />Five
</a>
<a class="anchor">
<img src="https://www.gstatic.com/images/icons/material/product/2x/pagespeed_64dp.png" />Six
</a>
</div>
</div>
https://stackoverflow.com/questions/54934723
复制相似问题