"parallax effect"
Bootstrap 3.3.0 Snippet by selvasekhar

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div id='container'>
<div id="group1">
<div class="background">
<center>I'm an element far away.</center>
</div>
<div class="foreground">
<center>I'm an element close by.</center>
</div>
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
div {
box-sizing: border-box;
}
#container {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
perspective: 1px;
overflow-x: hidden;
overflow-y: scroll;
}
#group1 {
height: 1000px;
position: relative;
transform-style: preserve-3d;
font-size: 20px;
}
.background {
/*effect the animation effect */
transform: translateZ(-1px);
height: 500px;
width: 100%;
position: absolute;
top: 0;
background: #FF8A8A;
padding-top: 100px;
}
.foreground {
position: absolute;
top: 500px;
height: 500px;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: