-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
101 lines (87 loc) · 1.59 KB
/
test.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
96
97
98
99
100
101
<!doctype html>
<style>
* {
box-sizing: border-box;
}
.container{
position: relative;
margin: 40px auto;
max-width: 800px;
width: 80%;
min-height: 240px;
}
.target{
position: absolute;
min-width: 30px;
min-height: 30px;
background: rgba(62, 215, 162, 0.55);
border: 2px solid rgba(62, 215, 162, 1);
}
#target-1{
top: 2em;
left: 3em;
width: 3em;
height: 2em;
margin: 5px;
}
#target-2{
position: relative;
top: 5em;
left: 7em;
width: 5em;
height: 4em;
margin: 7px;
}
#target-3{
bottom: 0em;
right: 16em;
width: 4em;
height: 6em;
margin: 10px;
}
#target-4 {
position: fixed;
right: 100px;
bottom: 200px;
width: 10vw;
height: 10vw;
}
.displacer {
position: relative;
top: 30px;
left: 40px;
margin: 10px;
padding: 10px;
}
nav{
text-align: center;
}
</style>
<div class="container">
<div id="target-1" class="target"></div>
<div class="displacer">
<div id="target-2" class="target"></div>
</div>
<div id="target-3" class="target"></div>
<div id="target-4" class="target"></div>
</div>
<nav>
<button id="left">←</button>
<button id="center">|</button>
<button id="right">→</button>
<button id="top">↑</button>
<button id="middle">—</button>
<button id="bottom">↓</button>
</nav>
<script src="bundle.js"></script>
<script>
var align = require('aligner');
var targets = document.querySelectorAll('.target');
var btns = document.querySelectorAll('button');
for (var i = btns.length, btn; i--;) {
btn = btns[i];
btn.onclick = function(){
align(targets, this.id);
};
}
</script>