繁体   English   中英

无法在 IE 中通过 Javascript 更改 srcset

[英]Unable to change srcset by Javascript in IE

我想在此代码片段中用 750x1280 替换所有尺寸 375x270 和 250x180:

<img class="j-webview-product-image" imgsrc="
https://image.jimcdn.com/app/cms/image/transf/dimension=375x270:format=jpg/path/sbcfc830c2d85c206/image/i547767095dfc0c2d/version/1475157973/image.jpg 375w,  
https://image.jimcdn.com/app/cms/image/transf/dimension=250x180:format=jpg/path/sbcfc830c2d85c206/image/i547767095dfc0c2d/version/1475157973/image.jpg 250w"
sizes="(max-width: 480px) 100vw, 250px" src="
https://image.jimcdn.com/app/cms/image/transf/dimension=250x180:format=jpg/path/sbcfc830c2d85c206/image/i547767095dfc0c2d/version/1475157973/image.jpg" 
alt="" title="" data-pin-nopin="true">

这是我的小提琴: http : //jsfiddle.net/andreaszeike/rtywrt9k/4/ - 该代码在除 IE 之外的所有浏览器上运行良好......

截至 2016 年,Internet Explorer不支持 srcsethttp : //caniuse.com/#feat=srcset

您正在用 jquery 进行替换工作正常,只是 Internet Explorer 完全忽略了 srcset。 您可以尝试为 IE 使用 srcset polyfill,如下所示: https ://scottjehl.github.io/picturefill/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM