添加“加载"图像到来自flickr的动态图像 [英] adding a "loading" image to dynamic images comming from flickr

查看:73
本文介绍了添加“加载"图像到来自flickr的动态图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在用于显示使用flickr生成的动态图像的加载图像的方法?我在 http://community.wacom.com/网站上遇到了此版本的工作版本,但是我无法找到代码来查看他们在做什么.

Is there a method for showing a loading image for dynamic images that are generated using flickr? I have come across a working version of this at the http://community.wacom.com/ site but I have not been able to locate the code to see what they are doing.

推荐答案

您可以创建显示加载gif的图像.然后创建另一个图像并使用图像加载事件.这为您提供了回调,通知您flickr映像何时准备就绪.然后只需换掉flickr中加载图片的gif文件即可.

You can create an image that shows a loading gif. Then create another image and use the image load event. This provides a callback to you notifying when the flickr image is ready. Then just swap out the loading gif for the image from flickr.

很明显,如果您使用json供稿作为url并迭代json对象,那么您将需要更改逻辑,但这应该使您有一个核心的了解.

Obviously you will need to change the logic if your using a json feed for the url's and iterating the json object but this should give you the core understanding.

HTML
<image id="image1" src="someLoad.gif" />

js
$('<img />').attr('src', 'someImageFromFlickr.jpg').load( function(){
    $('#image1').attr('src', this.src);
})

这篇关于添加“加载"图像到来自flickr的动态图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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