-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtake1.html
79 lines (63 loc) · 1.97 KB
/
take1.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Randomness</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;
}
</style>
<script type="text/javascript">
var store = [];
var topLimit = 100;
function goForIt()
{
var root = document.body;
var divy, pt;
//var root = document.getElementById("leMainDiv");
//remove all culd say innerHTML = '' but some cruft about IE < 9 not liking it
// while( root.hasChildNodes() ){
// root.removeChild(root.lastChild);
// }
for( var i=0; i < topLimit; i++ )
{
divy = document.createElement('div');
divy.setAttribute("id", "sudDiv" + i );
divy.innerHTML = i + 1;
divy.className = "leDiv";
pt = getNewPoint();
divy.setAttribute("style","left:" + pt.rx + "px; top:" + pt.ry + "px;");
root.appendChild( divy );
store[i] = divy;
}
}
function shakeEmUp()
{
for( var i=0; i < topLimit; i++ )
{
pt = getNewPoint();
store[i].style.top = pt.ry + "px";
store[i].style.left = pt.rx + "px";
}
}
function getNewPoint()
{
return { rx:Math.round( Math.random() * 800 ), ry:Math.round( Math.random() * 600 )};
}
</script>
</head>
<body onload="goForIt()" onclick="shakeEmUp();" >
<p>Tap a Card to shuffle!</p>
</body>