-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathtest.html
82 lines (77 loc) · 1.77 KB
/
test.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html>
<head>
<title>Smooth Parallax Test</title>
<style type="text/css">
.container {
position: relative;
width: 100%;
height: 2000px;
background-color: #ddd;
}
.spacer {
width: 100%;
height: 100vh;
background-color: wheat;
}
.green,
.blue,
.yellow {
position: absolute;
margin: 0 auto;
width: 600px;
height: 300px;
}
.green { background-color: green; top: 0%; }
.blue { background-color: blue; top: 5%; }
.yellow { background-color: yellow; top: 10%; }
.debug {
z-index: 99;
position: fixed;
top: 0;
right: 0;
width: 200px;
height: 100px;
background-color: #222;
color: #fff;
}
</style>
<script type="text/javascript" src="dist/smooth-parallax.js"></script>
<script type="text/javascript">
function loopDebug () {
var debug = document.querySelector( '.debug' );
debug.innerHTML = 'Scroll %: ' + window.SmoothParallax.getScrollPercent();
requestAnimationFrame( loopDebug );
};
window.addEventListener("load", function () {
SmoothParallax.init({ basePercentageOn: "containerVisibility" });
loopDebug();
});
</script>
</head>
<body>
<div class="debug"></div>
<div class="spacer">spacer</div>
<div class="container">
<div class="green"
smooth-parallax=""
base-size="containerSize"
start-movement=".1"
end-movement=".3"
end-position-x="1">
base-size: containerSize
</div>
<div class="blue"
smooth-parallax=""
start-movement=".15"
end-movement=".7"
start-position-x=".5">
</div>
<div class="yellow"
smooth-parallax=""
start-movement=".20"
end-movement=".9"
end-position-y=".5"></div>
</div>
</body>
</html>