简体   繁体   English

srcset在iPhone上不起作用

[英]srcset doesn't work on iPhone

I'm using srcset on my project, everything goes well till I test on iPhone, then srcset sudenly don't work, here my code: 我在我的项目上使用srcset,一切正常,直到在iPhone上进行测试,然后srcset突然不起作用,这是我的代码:

 <picture class="banner-hero__picture-container">
   <source srcset="../../../../../xxx/01-480.jpg" media="(max-width: 479px)">
   <source srcset="../../../../../xxx/01-768.jpg" media="(max-width: 767px)">
   <source srcset="../../../../../xxx/01-1200.jpg" media="(max-width: 1199px)">
   <img src="../../../../../xxx/01-1920.jpg" class="banner-hero__image">
 </picture>

I know there are sone rules about pixel density, but on iPhone in portait (320px, avec retina 640px) the image loaded is the 1920px, not even the 768px. 我知道有关于像素密度的规则,但是在iPhone上的肖像(320像素,视网膜640像素)中,加载的图像是1920像素,甚至不是768像素。

(tested on iPhone 5) (在iPhone 5上测试)

picture is not supported yet in WebKit. WebKit尚不支持picture Use picturefill. 使用图片填充。

http://caniuse.com/#feat=picture http://scottjehl.github.io/picturefill/ http://caniuse.com/#feat=picture http://scottjehl.github.io/picturefill/

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

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