-
Notifications
You must be signed in to change notification settings - Fork 32
/
index.html
executable file
·61 lines (49 loc) · 1.55 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
<script src="insQ.js"></script>
<style>
.container span {
padding: 5px;
font-size: 0;
margin: 1px;
background: green;
}
.container {
overflow: visible;
}
</style>
</head>
<body>
<div class="container">
<span></span>
</div>
<p>Open the console and watch...</p>
<button class="js-add">add one</button>
<button class="js-spray">add multiple</button>
<button class="js-container">add container</button>
<script>
insertionQ("span").summary(function(summary) {
console.log(summary)
})
var container = document.querySelector(".container");
document.querySelector(".js-add").addEventListener("click", function() {
container.appendChild(document.createElement("span"))
})
document.querySelector(".js-spray").addEventListener("click", function() {
for (var i = 0; i < 10; i++) {
container.appendChild(document.createElement("span"))
}
})
document.querySelector(".js-container").addEventListener("click", function() {
var box = document.createElement("div")
box.appendChild(document.createElement("span"))
box.appendChild(document.createElement("span"))
container.appendChild(box)
container.appendChild(document.createElement("span"))
})
</script>
</body>
</html>