-
Notifications
You must be signed in to change notification settings - Fork 1
/
8_3_parallax_vertical3.html
56 lines (45 loc) · 2.52 KB
/
8_3_parallax_vertical3.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!doctype html>
<html lang="en">
<head>
<title>Parallax vertical</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<style>
img {
width: 10%;
position: absolute;
}
</style>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
</head>
<body>
<div class="container-fluid" style="background-color:beige;min-height: 1000px">
<img class="bg3" src="images/ballon01.png" data-pos="400" style="left:15%;top:400px">
<img class="bg3" src="images/ballon02.png" data-pos="450" style="left:25%;top:450px;">
<img class="bg3" src="images/ballon03.png" data-pos="500" style="left:35%;top:500px;">
<img class="bg2" src="images/ballon04.png" data-pos="550" style="left:45%;top:550px;">
<img class="bg2" src="images/ballon05.png" data-pos="600" style="left:55%;top:600px;">
<img class="bg1" src="images/ballon06.png" data-pos="650" style="left:65%;top:650px;">
</div>
<div class="container-fluid" style="background-color:darkgrey;min-height: 2000px"></div>
<script>
$(document).ready(function() {
$(window).scroll(function() {
var scrolled = $(window).scrollTop();
$(".bg3").each(function() {
$(this).css('top', ($(this).data("pos") - scrolled * .35 + scrolled) + 'px');
});
$(".bg2").each(function() {
$(this).css('top', ($(this).data("pos") - scrolled * .55 + scrolled) + 'px');
});
$(".bg1").each(function() {
$(this).css('top', ($(this).data("pos") - scrolled * .75 + scrolled) + 'px');
});
});
});
</script>
</body>
</html>