使用 JavaScript 异步加载图像
有没有一种方法可以显示使用 Flickr 生成的动态图像的加载图像? 我遇到了一种方法,如 Wacom 社区 网站所示,但我无法获得让它工作。 有没有比 http://blog.realmofzod.com/asynchronous-image-loading-with-jquery/?
Is there a method for showing a loading image for dynamic images that are generated using Flickr? I have come across a way to do it as shown on the Wacom Community site but I have not been able to get it to work. Is there something simpler or does anyone have a better explanation than the originator of the technique from http://blog.realmofzod.com/asynchronous-image-loading-with-jquery/?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚开始工作。 YMMV:
然后
replaceImage
:blank.gif 只是一个 1x1 像素的纯灰色图像。 基本上,这个想法是加载这个空白图像并将其扩展到 75x75(以保留布局)。 这几乎立即触发 onload 处理程序,将图像的源更改为所需的图像。 它有你想要的效果。
I just got this working. YMMV:
And then
replaceImage
:blank.gif is just a 1x1 pixel solid gray image. Basically, the idea is that this blank image is loaded and expanded to 75x75 (to preserve layout). That almost immediately fires the onload handler, which changes the image's source to the desired image. It has the effect you desire.
可以用 jquery 做到:
could do it with jquery: