CSS背景图片载入检查 [英] CSS background-images onload check

查看:120
本文介绍了CSS背景图片载入检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 http://desandro.github.com/imagesloaded/ imagesLoaded插件,效果很好用于检测div的图像何时加载:

Im using http://desandro.github.com/imagesloaded/ imagesLoaded plugin which works great for detecting when a div's images have loaded:

$('.background').imagesLoaded(function() {
console.log('background loaded');
});

我还需要检查通过CSS应用的背景图片是否已加载,因为上述插件似乎并未监听背景图片.

I need this to also check when a background-image applied via CSS has been loaded as the above plugin doesnt seem to listen for background-images.

有什么想法吗?

推荐答案

看看 waitForImages 插件,它可以检测CSS中引用的图像的加载.

Take a look at waitForImages plugin, it can detect loading of images referenced in the CSS.

https://github.com/alexanderdickson/waitForImages

这篇关于CSS背景图片载入检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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