-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
52 lines (44 loc) · 1.19 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
<!DOCTYPE html>
<html>
<head>
<title>"click-outside" module test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
.item {
display: inline-block;
min-width: 100px; min-height: 100px;
border: solid 1px black;
margin: 5px;
}
</style>
</head>
<body>
<div id="x" class="item"> bla
<div id="y" class="item"> baz
</div>
</div>
<div id="a" class="item"> foo
<div id="b" class="item"> bar
</div>
</div>
<button id="stop">unbind "foo"</button>
<div id="out"></div>
<script src="build.js"></script>
<script>
var x = document.getElementById('x');
var stopX = clickOutside(x, function (e) {
console.log('click outside "x"', this, e);
});
var a = document.getElementById('a');
var stopA = clickOutside(a, function (e) {
console.log('click outside "a"', this, e);
});
var stop = document.getElementById('stop');
stop.onclick = function (e) {
console.log('stopping watching id="a" div for "click outside');
stopA();
stop.onclick = null;
};
</script>
</body>
</html>