-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
67 lines (61 loc) · 1.78 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery.1.10.1.min.js"></script>
<script type="text/javascript" src="jquery.transition.min.js"></script>
<script type="text/javascript" src="binpacking.js"></script>
<script type="text/javascript">
$(document).ready(function () {
"use strict";
var binCount = $('.bin').length;
function addBin() {
$('#container').binpack([
$('<div />', {
'class': 'bin',
'html': ++binCount,
'css': {
// 'width': 300 * (1 + Math.round(Math.random())),
'height': 100 + Math.random() * 300
}
})
]);
}
while (binCount < 20) {
addBin();
}
$('#container').binpack({
'target': '.bin',
'bindResize': true,
'animationDuration': 600
});
$(document).on('click', '.bin', addBin);
$(window).scroll(addBin);
});
</script>
<style type="text/css">
#container {
display: block;
width: 100%;
margin: 0 auto;
padding: 0;
background: #1ab2c3;
font-family: sans-serif;
}
.bin {
border: 1px solid silver;
border-radius: 3px;
width: 300px;
height: 200px;
margin: 5px;
box-shadow: 0 1px 3px 0 rgba(0,0,0,0.33);
background: #fff;
opacity: 0.7;
}
</style>
</head>
<body>
<div id="container">
</div>
</body>
</html>