Gih*_*ita 4 html javascript css jquery
我这样做是为了加载图像并在对话框中显示图像.
<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"); } }
});
Run Code Online (Sandbox Code Playgroud)
是否有方法显示加载gif图像加载jquery?
问候
在img标记中设置初始加载gif图像.然后使用javascript Image对象和onload事件预加载图像; 当目标图像做预压,更换src你的img,其URI标签.
<div id="image_preview" title="Client Photo Preview">
<p><img src="loading.gif" alt="client image" id="client_image_preview" /></p>
</div>
var img = new Image();
img.onload = function() {
$("#client_image_preview").attr("src", imagelocation);
}
img.src = imagelocation;
$('#image_preview').dialog({
height: 'auto',
width: 'auto',
modal: true,
dialogClass: 'titleless',
buttons: { "CLOSE": function() { $(this).dialog("destroy"); } }
});
Run Code Online (Sandbox Code Playgroud)