滚动与IE7 / 8兼容时更改背景图像

时间:2014-01-02 22:50:11

标签: html css internet-explorer-8 internet-explorer-7 css3pie

当您滚动到页面的新部分时,我有一个更改背景图像的网页。可以查看here。我无法在IE7 / 8上显示更改的背景图像。我尝试使用css3pie,但它似乎没有工作。以下是我的html示例:

<!-- background image section w/ text on top -->
<section id="anvil" class="bg">
  <div class="center text">
    <p class="imageCopy">Stunningly beautiful colors...</p>
  </div>
</section>

<section class="divider">
  <!-- this is the divider section -->
</section>

<!-- new background image section -->
<section id="office" class="bg">
  <div class="center text">
    <p class="imageCopy">at a price you can afford.</p>
  </div>
</section>

和css:

#anvil {
  background-image: url(/images/anvil.jpg); 
  -pie-background: url(/images/anvil.jpg) no-repeat;
  behavior: url(/PIE-1.0.0/PIE.htc);
 }
 #office {
  background-image: url(/images/office.jpg);
  -pie-background: url(/images/office.jpg) no-repeat;
  behavior: url(/PIE-1.0.0/PIE.htc);
 }

 .bg {
   background-repeat: no-repeat;
   background-attachment: fixed;
   -webkit-background-size: cover;
   background-size: cover;
   -moz-background-size: cover;
   -o-background-size: cover;
   background-position: 0 -80px; /* IE 8 fix */
   background-position: 0 -5rem;
   height: 47rem; 
   height: 750px; /* IE 8 fix */
 }
 .divider {
   background-color: #000000;
   height: 29rem;
   height: 464px; /* IE 8 fix */
 }

我很难确定究竟是什么导致了IE的问题,所以我可能在背景属性的错误轨道上(例如,IE 7/8不支持这些部分,但我认为我修复了那)。任何建议将不胜感激!谢谢!

0 个答案:

没有答案
相关问题