Safari 9忽略图片元素

时间:2015-11-25 00:25:44

标签: html image safari srcset

我正在尝试实现艺术指导,并使<picture>元素在移动设备上显示方形图像,在所有其他设备上显示风景图像。出于某种原因,Safari会一直回到<img>标记,因为它应该能够识别我在这里给出的<source srcset="">值。

<picture>
  <source media="(max-width: 480px)" srcset="http://placehold.it/480x480">
  <source media="(max-width: 640px)" srcset="http://placehold.it/640x320">
  <source media="(max-width: 1024px)" srcset="http://placehold.it/1024x600">
  <img src="http://placehold.it/1224x1224/c00/fff" alt="">
</picture>

这似乎可以在Chrome中找到,但有人可以解释为什么Safari会忽略这些srcset属性以及如何让它在Safari 9中运行吗?谢谢!

2 个答案:

答案 0 :(得分:2)

Safari 9不支持$('.selector').on('click', function(){ if (check_if_popup_is_active) { return; } // otherwise continue with // your callback functionality }); ,但它看起来像Safari 9.1一样! https://developer.apple.com/library/archive/releasenotes/General/WhatsNewInSafari/Articles/Safari_9_1.html?ref=webdesignernews.com

答案 1 :(得分:1)

Safari 9并不支持<picture>。它仅支持<img srcset>。 如果您需要<picture>对Safari的支持,您可能希望将picturefill添加到您的网站。

相关问题