javascript - 背景尺寸 : cover causing background image to resize on touch in mobile Chrome

标签 javascript jquery html css jquery-mobile

我在将移动页面的背景图像设置为专为移动设备设计的新图像时遇到问题。图片设置为 background-size: cover,并且在除移动版 Chrome 之外的所有应用中都可以正常工作。在移动版 Chrome 中滚动时,图像会稍微调整大小。该设计还有一个绝对页脚。你可以在这里看到它的实际效果:

body {
  height: 100%;
  overflow: scroll;
  }

.image {
  display: block;
  background: url(http://drawingimage.com/files/1/Shrek-Donkey-Beautiful-Image-Drawing.png) no-repeat center bottom;
  background-size: cover;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.footer {
  display: block;
  position: absolute;
  width: 100%;
  bottom: -69px;
  background-color: green;
}
<body>
  <div class="wrap">
    <div class="image">
    </div>
    <div class="footer">
    <p> Footer info </p>
    <p> More footer info</p>
    </div>
  </div>
</body>

最佳答案

如果它覆盖了背景,那么它就会为滚动留出空间。也许约束容器。或者考虑使用任何类型的媒体查询来解决移动尺寸的问题。将其切换为仅包含在移动设备上。或删除移动设备上的溢出滚动条。

关于javascript - 背景尺寸 : cover causing background image to resize on touch in mobile Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40223881/

相关文章:

javascript - iframe 在 AngularJS 1.3.0 中不起作用

javascript - 如何使用 jQuery masonry 插件放置图像开始

javascript - PHP:在网络浏览器中输出 system/Shell_exec 命令输出

javascript - Promise.resolve()和resolve()之间的区别?

javascript - jQuery:如何仅在 div 展开后淡入导航?

javascript - 更改拖动对象并在放置后恢复它

javascript - Google Chart 无法在图表区正确显示

javascript - jquery 动画不起作用

javascript - Edge Animate 下层阶段的可访问性

javascript - 单元格最后修改日期的函数