簡體   English   中英

目標(即8和更低)將“ x-img src”轉換回“ img src”

[英]target ie 8 and lower to convert 'x-img src' back to 'img src'

我正在將mobify.js用於響應式圖像。 但是,我必須在img src之前添加“ x”,以便其讀取為“ x-img src”。 此功能適用於除8及以下版本以外的所有瀏覽器。

所以我的問題是,有沒有一種方法可以使用JavaScript將ie中的“ x-img src”標簽更改回普通的“ img src”標簽?

//sets the image source equal to the x-src
element.setAttribute('src',element.getAttribute('x-src'));
//removes x-src
element.removeAttribute('x-src');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM