我的视差是滞后的,我只使用CSS构建它

时间:2017-04-29 15:28:11

标签: html css css3 parallax lag

我认为制作我的视差CSS只会让事情变得不那么迟钝,但似乎没有。如果你想查看代码并告诉我是否有什么做得不好,我会很感激。

html:

<div class="parallax">  
<div id="up">

    <div class="spacer"></div>

        <div id="intro">

            <h1>A studio made up of   </h1>
            <h2 class="future-animate">  1</h2>
            <div class="animate"></div>
            <h1> person,</h1>

        </div>

    <div class="spacer"></div>

</div>

css:

.parallax {
/* The image used */
background: url('bgintro.jpg');

/*sizing height */
height: 799px; 
width: 100%;

/* Creating the parallax scrolling effect */
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
float: left;
display: inline-block;
z-index: -1;
}

@media only screen and (max-device-width:1024px) {
.parallax{
    background-attachment: scroll;
 }
 }

和小提琴:

https://jsfiddle.net/ovyhttgw/

提前致谢。

0 个答案:

没有答案