Im doing this to load image and show image inside a dialog box.
<div id="image_preview" title="Client Photo Preview">
<p><img src="" alt="client image" id="client_image_preview" /></p>
</div>
$("#client_image_preview").attr("src", imagelocation);
$('#image_preview').dialog({
height: 'auto',
width: 'auto',
modal: true,
dialogClass: 'titleless',
buttons: { "CLOSE": function() { $(this).dialog("destroy"); } }
});
is there way to show a loading gif while image loads with jquery?
Regards
Set an initial loading gif image in your
imgtag. Then preload the image using a javascriptImageobject andonloadevent; when the target image is done preloading, replace thesrcof yourimgtag with its URI.