回答
首先,将图像的容器元素的背景设置为黑色(以便在图像未显示时至少不会看到白色)是一个好主意,然后您可以应用默认情况下隐藏图像的默认CSS规则。然后,使用load
事件,您可以删除CSS:
// Get reference to the image element
var img = document.querySelector("#img");
// Set up an event handler for when the image is fully loaded that removes
// the hidden class, thus revealing the image:
img.addEventListener("load", function(){
img.classList.remove("hidden");
});
/* Set the size of the container to the size of the image and
set its background color to black. */
#container {
height:2000px;
width:2000px;
background-color:#000;
}
.hidden { visibility:hidden; }
<div id="container">
<img src="http://imgsrc.hubblesite.org/hvi/uploads/image_file/image_attachment/29911/STSCI-H-p1706a-m2000x2000.png" id="img" class="hidden">
</div>
此外,为了说明这一点,请尝试查看是否可以更多地压缩图像或以其他方式减少文件的使用,以便加快速度。 – dman2306
@ dman2306这当然是一个好主意,但仍然无法解决问题,多次刷新很快就会发生。 –
我试图测试一下,但是它将图像头部完全留空。 –
尽量摆脱对 '.slick初始化.hero__image' CSS的淡入动画。
.slick-initialized .hero__image{opacity:1;-webkit-animation:fadeIn 1s cubic-bezier(0.44, 0.13, 0.48, 0.87);-moz-animation:fadeIn 1s cubic-bezier(0.44, 0.13, 0.48, 0.87);-o-animation:fadeIn 1s cubic-bezier(0.44, 0.13, 0.48, 0.87);animation:fadeIn 1s cubic-bezier(0.44, 0.13, 0.48, 0.87)}
- 1. 在Facebook上检索jpeg图像会显着降低质量。
- 2. 在Jelly Bean中显着降低了webview的性能?
- 3. 追加属性降低
- 4. YouTube API检索数据显着降低我的网站在加载时
- 5. Android - 可以System.out.println()显着降低性能,就像它在PC上一样
- 6. Android,如何降低图像适配器中图像的高度?
- 7. 如何降低笨视图加载时间
- 8. 为什么添加另一个LOOKUP转换会显着降低性能SSIS
- 9. 从网站上传到服务器时图像质量显着降低?
- 10. ffmpeg如何降低低音和增加高音像大胆
- 11. 如何降低
- 12. 索引如何降低MySQL的性能?
- 13. 如何在加载大图像时显示加载图像?
- 14. 如何计算图像的显着性图以检测物体?
- 15. 降低复杂性
- 16. CCSprite降低性能
- 17. android中的图像显着性检测
- 18. 随着时间的推移性能降低
- 19. Stackless python网络性能随着时间的推移而降低?
- 20. Android - 要降低的像素
- 21. 在网页上使用链接的图像是否会降低加载速度?
- 22. 降低AWS EFS的性能
- 23. 增加块大小会降低性能
- 24. GC是否会影响设备电池的显着降低?
- 25. SQL Server性能问题。当“参数”记录的数量增加时,查询性能显着降低
- 26. 在Android中降低图像分辨率
- 27. 在OpenCV中降低图像分辨率
- 28. 在php中降低图像质量
- 29. 如何降低CSS中的图像亮度
- 30. 如何降低封面图像的压缩率?
你可以加载低分辨率图像,然后,一旦它被装载 – Anirudha
@AmericanSlime而尝试下面提出的解决方案具有更高分辨率的图像替换它,它去掉了图像头。 –
链接到该网站: https://shop-gohrvst.myshopify.com/ –