-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtake2.html
95 lines (76 loc) · 2.15 KB
/
take2.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
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
.leDiv
{
background-color: #444444;
color: #cdcdcd;
width: 100px;
line-height: 50px;
height: 50px;
text-align: center;
vertical-align: middle;
display: block;
position: absolute;
transition: all 1s ease-in-out;
-webkit-transition: all 1s ease-in-out;
left: 0px;
top: 60px;
}
</style>
<script type="text/javascript">
var topLimit = 36;
var store = [];
function setup()
{
var root = document.getElementById("leRoot");
var divy;
for( var i=0; i < topLimit; i++ )
{
divy = document.createElement('div');
divy.setAttribute("id", "sudDiv" + i );
divy.innerHTML = i + 1;
divy.className = "leDiv";
store[i] = divy;
root.appendChild( divy );
}
}
var squareIsDone = false;
function doSquare()
{
var rx, ry, divy;
if( squareIsDone )
{
for( var i=0; i < topLimit; i++ )
{
divy = store[ i ];
divy.style["left"] = "0px";
divy.style["top"] = "60px";
}
squareIsDone = false
}
else
{
ry = 0;
for( var i=0; i < topLimit; i++ )
{
rx = ( i % 6 ) * 110;// i * 100 + i * 10;
if( i % 6 == 0 )
{
ry = ry + 60;
}
divy = store[ i ];
divy.setAttribute("style","left:" + (rx) + "px; top:" + (ry) + "px;");
}
squareIsDone = true;
}
}
</script>
</head>
<body onload="setup()">
<p onclick="doSquare()">Tap Me!</p>
<div id="leRoot" style="left: 0px; top:60px;"></div>
</body>
</html>