这可能是一个非常简单的解决方案,但我似乎无法找到它。
我基本上希望第二个绿色div在第一个棕色的下面显示,所以当你向下滚动页面时,绿色的那个也会弹出。
<!doctype html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
* {
margin: 0;
padding: 0;
}
.content {
height: 1500px;
background-color: brown;
}
.parallax-bg {
padding: 400px 0;
background-image: url(skyline.jpg);
background-size: cover;
background-attachment: fixed;
-webkit-transition: all .02s ease;
-moz-transition: all .02s ease;
transition: all .02s ease;
z-index: 1;
}
.parallax-bg h1 {
text-align: center;
font-size: 100px;
font-family: Arial;
color: white;
}
#seconddiv {
background-color: green;
height: 1000px;
padding: 100px 0;
}
@media screen and (max-width: 568px) {
.parallax-bg h1 {
color: blue;
font-size: 50px;
position: relative;
top: -100px;
color: white;
}
}
</style>
</head>
<body>
<div class="content">
<div class="parallax-bg">
<h1>First Section</h1>
</div>
<div class="parallax-bg" id="seconddiv">
<h1>Second Section</h1>
</div>
</div>
</body>
</html>