简体   繁体   中英

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:

 <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.

(tested on iPhone 5)

picture is not supported yet in WebKit. Use picturefill.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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