Why does not (Pure CSS) Parallax Scrolling work properly in Chrome? (Slide #2 background bugs)

泄露秘密 提交于 2019-12-12 00:17:37

问题


It works perfectly great on IExplorer, FF, Opera, Safari, and even HTML Validator gives no errors or warnings whatsoever.. I'm totally helpless now :(

Site in question: http://www.ubiikki.net

As you can see, on second slide the background bugs and spreads to slide 3, not showing the proper background of that slide, like on all other browsers.

--

Code I have used (slide 2=slide1 in this code because actual slide1 is just slide):

HTML:

<div id="slide1" class="slide">

  <div class="title">
    <h1 class="black">UBI</h1>
    <p>...</p>
  </div>

  </div>


<div id="slide2" class="slide">

  <div class="title">
    <h1 class="black">UBIK LIST</h1>

    <div id="vasen" class="black">
    List A:<br />
<ul><li>Ubique</li>
<li>Ubique 2</li>
</ul></div>

<div id="oikea" class="black">
List B:<br />
<ul><li>
Ubique</li>
<li>UbiqueUbique</li>
</ul>
</div>

<div>
    <div style="float: left;"></div>
    <div style="clear: both;"></div> <!-- Clear the float -->
</div>

    </div>


</div>

CSS:

html {
  height: 100%;
  overflow: hidden;
}

body { 

    font-family: 'Josefin Sans', sans-serif;
  margin:0;
  padding:0;
    perspective: 1px;
    transform-style: preserve-3d;
  height: 100%;
  overflow-y: scroll;
  overflow-x: hidden;

  background-color:#000;
    color:#fff;

}

.slide {
  position: relative;
  padding: 25vh 10% 25vh 10%;
  min-height: 100vh;
  width: 100vw;
  box-sizing: border-box;
  box-shadow: 0 -.0625em .225em rgba(0, 0, 0, .5);
    transform-style: inherit;
}

.slide:before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left:0;
  right:0;
}

.title {
  width: 50%;
  padding: 5%;
  border-radius: 0.125em;
  background: rgba(240,230,220, .7);
  box-shadow: 0 0 0.5em rgba(0, 0, 0, .7);
}

.slide:nth-child(2n) .title {

 margin-left: auto;
  margin-right: 0;

}

.slide:nth-child(2n+1) .title {

   margin-left: 0;
  margin-right: auto;


}

.slide, .slide:before {
  background: 50% 50% / cover;  
}

.header {
    text-align:center;
    font-size: 2em;
    color: #fff;
    text-shadow: 0 0.125em 0.125em #000;
}

#title {


background-image: url(../images/background1.jpg);
background-attachment: fixed;  
}

#slide1:before {

background-image: url(../images/background3.jpg);

transform: translateZ(-.0625em) scale(2);
  z-index:-1;
}
.clearfix:after {
   content: " "; /* Older browser do not support empty content */
   visibility: hidden;
   display: block;
   height: 0;
   clear: both;
}


#slide2 {


background-image: url(../images/background2.jpg);


background-attachment: fixed;
}


#slide4 {
  background: #000;
}

来源:https://stackoverflow.com/questions/32416462/why-does-not-pure-css-parallax-scrolling-work-properly-in-chrome-slide-2-ba

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!