jquery - 视网膜 2x 图像中的微小尺寸差异是否重要?

标签 jquery css retina.js

我正在为视网膜显示器调整我的网页,我正在使用 IrfanView 来加倍我的图像。但是,通常 640 x 427 px 的图像现在变成了 1281 x 855 px。这会按预期工作吗?我也在使用 Retina js。

最佳答案

如果你想为 Retina 显示添加图像,你必须这样做:

对于普通屏幕:

background: url('example_image.png') no-repeat; (example_image.png 640px x 427px)

对于视网膜显示:

@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (   min--moz-device-pixel-ratio: 2),
only screen and (     -o-min-device-pixel-ratio: 2/1),
only screen and (        min-device-pixel-ratio: 2),
only screen and (                min-resolution: 192dpi),
only screen and (                min-resolution: 2dppx){
  .your_element{
    background: url('example_image@2x.png') no-repeat;
    background-size: 640px 427px; 
  }
}

(example_image@2x.png 1280px x 854px)

关于jquery - 视网膜 2x 图像中的微小尺寸差异是否重要?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20627048/

相关文章:

javascript - 通过 src 删除图像

当鼠标悬停在一个图像上时,jquery 或 CSS 会使其余图像变暗

html - 网络开发中的 Retina 设备 : Do I still need to have 2x images?

javascript - 抑制 retina.js 库中的 404 错误

javascript - 在 Firefox 中加载大型 HTML 表的动画

javascript - 使用 jquery 禁用表单元素

javascript - 使用一个命令放置一个按钮及其 div

javascript - 由 jQuery 设置的内联 CSS 'resize event' 在窗口调整大小后重置为默认值

javascript - 样式屏蔽输入插件的问题

javascript - 基于媒体查询/视口(viewport)的 JavaScript 中的 Else 语句或 'Retina' -修复