开发者

jQuery tmpl display loading image on images

开发者 https://www.devze.com 2023-04-10 04:00 出处:网络
I have a template like so <script id=\"itemtemplate\" type=\"text/x-jquery-tmpl\"> <img id=\"pho开发者_高级运维to${id}\" src=\"${$item.image(filename)}\" />

I have a template like so

<script id="itemtemplate" type="text/x-jquery-tmpl">
    <img id="pho开发者_高级运维to${id}" src="${$item.image(filename)}" />
</script>

which works nicely with displaying images but between the page loading and the image actually being displayed, I would like to have an ajax-loading animated gif.

So my initial template would look like so

<script id="itemtemplate" type="text/x-jquery-tmpl">
    <img id="photo${id}" src="../../media/images/loadingsm.gif" />
</script>

Now when the template gets fired, the src is replaced with ${$item.image(filename)}

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号