![](/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.