-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html~
63 lines (54 loc) · 1.2 KB
/
demo.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
<html>
<head>
<script type="text/javascript" src="lib/jquery.min.js"></script>
<script type="text/javascript" src="parallax.js"></script>
<script type="text/javascript">
$(function() {
$(document).click(function() {
$('#container').append($('<div class="parallax item'+Math.ceil(Math.random()*3)+'"></div>').attr('data-pos', 10-Math.random()*20).css({
left: Math.random()*800,
right: Math.random()*800}));
registerObject($('#container').children().last());
});
});
</script>
<style>
.item1 {
position: absolute;
width: 50px;
height: 50px;
border: 2px solid black;
left: 175px;
top: 175px;
background-color: blue;
}
.item2 {
position: absolute;
width: 75px;
height: 75px;
border: 3px solid black;
left: 300px;
top: 300px;
background-color: red;
}
.item3 {
position: absolute;
width: 60px;
height: 60px;
border: 2px solid black;
left: 200px;
top: 200px;
background-color: yellow;
}
</style>
</head>
<body>
<div id="parallax-parameters" data-origin=0 data-x_ratio=10 data-y_ratio=10></div>
<div id="container">
<div class="parallax item1" data-pos=1></div>
<div class="parallax item2" data-pos=-3></div>
<div class="parallax item3" data-pos=-1></div>
</div>
<item1>
</body>
</html>