繁体   English   中英

'background-size:cover'在ipad中不起作用

[英]'background-size:cover' does not work in ipad

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

这是我的代码:

 $(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> 

谁能给我解决方案

输出量 在浏览器上输出

在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;

}

我的正在为此工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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