html - '背景大小 :cover' does not work in ipad

标签 html ios css ipad

您好,我正在尝试创建一个视差网站。我的代码在每个浏览器中都运行良好。但我在 ipad 上遇到了一些问题。在 ipad background-size: cover 中不起作用。

这是我的代码:

$(document).ready(function(){
  $('section[data-type="background"]').each(function(){
    var $bgobj = $(this); // assigning the object
    $(window).scroll(function() {

      // Put together our final background position

      var yPos = -($window.scrollTop() / $bgobj.data('speed'));
      var coords = '50% '+ yPos + 'px';

      // Move the background
      $bgobj.css({ backgroundPosition: coords });

    });
  });
});
#section1 {
  background: url(images/hlfs-image.jpg) 0% 0% no-repeat fixed; 
  min-height: 1000px ;
  height: 1000px ;
  margin: 0 auto ;
  width: 100%;
  max-width: 1920px ;
  position: relative ;
  background-size:cover ;

}
 <section id="section1" data-type="background" data-speed="10" class="pages"> </section>

谁能给我一个解决方案

输出 Output at browser

Output at ipad

最佳答案

尝试使用

 #section1 {
      background: url(images/hlfs-image.jpg) 0% 0% no-repeat fixed; min-height: 1000px !important;
  height: 1000px !important;
  margin: 0 auto !important;
  width: 100%;
  max-width: 1920px !important;
  position: relative !important;
  background-size:cover !important;
  -webkit-background-size: cover;

}

我的正在处理这个..

关于html - '背景大小 :cover' does not work in ipad,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27010477/

相关文章:

ios - CNContacts 框架可能存在电话标识符错误?

html - 并排设计 div block ,使它们保持一致

html - 在 Chrome 中为 <video> 标签添加边框半径

ios - 遇到 "ERROR ITMS-90707: "您上传的二进制文件无效。”上传到 App Store Connect 时

ios - AFNetworking 库在 iOS 7 中失败

css - 写 div#id_name 与 #id_name 有什么意义?

html - 如何在CSS中为几何图形添加边框?

html - 列表中的图像链接位置奇怪

javascript - 导航选项卡无法插入图像。如何将图像作为图标放在导航选项卡中?

css - 为我的网站编写 <address> 标记的正确方法,以提供我们公司的联系方式