0
是否存在,如果第一onError的不存在使用的onError兩次
<img class="media-object img-responsive" src="/img/product/{{ product_type_slug }}/thumb/{{ image_thumb }}" alt="{{ name }}"
onError="
this.onerror=null;
this.src='/img/product/swatch/{{ image }}';">
尋找一個onerror的使用onError的兩倍的方式爲onError的展現:
src='/img/product/{{ product_type_slug }}/old/{{ image_thumb }}'
所以,如果原來的圖像不存在顯示樣本網址,如果不存在顯示舊的。
只是似乎沒有與我的動態src的工作:/你的答案是正確的,雖然靜態src的,這仍然只是顯示/ img/product/{{product_type_slug}} /拇指/ {{image_thumb}}缺少對於某些產品而言,僅向瀏覽器展示破碎的圖像 –
靜態和動態之間沒有區別,它只是一個圖像源。你是否在'data-alternative'屬性中添加了替代方法?例如'data-alternative =「/ img/product/swatch/{{image}}」'? –
是的,我複製你的,並將你的src的替換爲我的,我會繼續嘗試 –