forked from burg/timelapse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
size-of-box-with-zoom.html
74 lines (70 loc) · 1.67 KB
/
size-of-box-with-zoom.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
<!DOCTYPE html>
<html>
<head>
<title>size of box zoom test</title>
<style>
body {
background: silver;
}
#container {
background: white;
width: 500px;
height: 50px;
}
#ruler > div {
float: left;
width: 49px;
border-right: 1px solid black;
text-align: right;
height: 50px;
}
#test {
clear: left;
position: absolute;
top: 30px;
}
#test > div {
clear: left;
}
#test > div > div {
float: left;
width: 5px;
height: 10px;
background: navy;
}
#console {
clear: left;
}
</style>
</head>
<body>
<div id="container">
<div id="ruler"></div>
<div id="test"><div></div></div>
</div>
</body>
<script>
var testContainer = document.getElementById('test');
var rulerElement = document.getElementById('ruler');
function init()
{
rulerElement.innerHTML = '';
for (var i = 0; i < 10; i++) {
rulerElement.appendChild(document.createElement('div'));
rulerElement.lastChild.appendChild(document.createTextNode(50 + i * 50));
}
}
function test(zoom)
{
var testElement = document.createElement('div');
testElement.style.zoom = zoom + '%';
for (var i = 0; i < 100; i++)
testElement.appendChild(document.createElement('div'));
testContainer.appendChild(testElement);
}
init();
test(100);
test(65);
test(30);
</script>
</html>