jQuery克隆映像从服务器重新加载 [英] JQuery clone image reloads from server
本文介绍了jQuery克隆映像从服务器重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用以下代码从页面克隆图像并将其追加到div时,它们将从服务器重新加载.这是预期的行为吗?我正在使用FF9.谢谢
When i use the following code to clone images from the page and append to a div, they get reloaded from the server. Is this expected behaviour? I am using FF 9. Thanks
var modal = $('<div id="modal"></div>');
$('img').each(function(){
$(this).clone().appendTo(modal);
});
推荐答案
克隆图像时,将创建一个新的<img>
标签,该标签的呈现方式与任何新的<img>
标签相同.如果服务器未为标记所指向的图像指定任何缓存行为,则大多数浏览器在看到新的<img>
标记时都会发出请求.
When you clone the image, you create a new <img>
tag, which is rendered like any new <img>
tag would be. Most browsers would make a request when they see a new <img>
tag, if the server did not specify any caching behavior for the image to which the tag points.
这篇关于jQuery克隆映像从服务器重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文