开发者

Image servlet file delivery completion event

开发者 https://www.devze.com 2023-03-07 19:18 出处:网络
Suppose there is a 4.3 mb png file.I used Balus c Image servlet to show the image inline in my jsp page.But the file being 4.3mb in size takes time to download.I would like t开发者_JS百科o show a load

Suppose there is a 4.3 mb png file.I used Balus c Image servlet to show the image inline in my jsp page.But the file being 4.3mb in size takes time to download.I would like t开发者_JS百科o show a loading gif in the meantime and keep the image hidden by setting its style as "display:none;".The question is how do i know that the image has been delivered completely by the servlet before rendering the image.


You can put the url of your gif image in the html produced by the jsp, then fetch the image at load time:

$(function() {
    var loadr = new Image();
    $(loadr).load(function() {
        $("#myimg").attr("src", this.src);
    });
    loadr.src = "servletUrl";
});
0

精彩评论

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

关注公众号