![](/img/trans.png)
[英]Setting the img src to be the img src on another website based on img id
[英]Preloading img and inserting src into another img without reloading it
我正在尝试通过javascript预加载图像,并在适当的时候将其插入另一个图像,而无需进行新的提取。
不幸的是,当我用预加载的src替换img的src时,图像被重新加载,而chrome不使用已兑现的src。 我能做什么?
这就是我预加载图像的方式:
if (document.images) {
this.img = new Image();
this.img.src = "img/img.jpg";
}
然后我像这样插入它:
this.poster.src = this.img.src;
谢谢!
实际上,此代码可以正常工作。 我使用的预处理器将禁止缓存。 在服务器上一切正常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.