-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path8_4_parallax_vertical4.html
49 lines (39 loc) · 2.34 KB
/
8_4_parallax_vertical4.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
<!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="parallax" src="images/ballon01.png" data-pos="100" data-speed="1" style="left:15%;top:100px">
<img class="parallax" src="images/ballon02.png" data-pos="150" data-speed=".9" style="left:25%;top:150px;">
<img class="parallax" src="images/ballon03.png" data-pos="200" data-speed=".8" style="left:35%;top:200px;">
<img class="parallax" src="images/ballon04.png" data-pos="250" data-speed=".7" style="left:45%;top:250px;">
<img class="parallax" src="images/ballon05.png" data-pos="300" data-speed=".6" style="left:55%;top:300px;">
<img class="parallax" src="images/ballon06.png" data-pos="350" data-speed=".5" style="left:65%;top:350px;">
</div>
<div class="container-fluid" style="background-color:darkgrey;min-height: 2000px"></div>
<script>
$(document).ready(function() {
$(window).scroll(function() {
var scrolled = $(window).scrollTop();
$(".parallax").each(function() {
$(this).css('top', ($(this).data("pos") + scrolled * $(this).data("speed")) + 'px');
});
});
});
</script>
</body>
</html>