This repository has been archived by the owner on Oct 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
113 lines (106 loc) · 3.69 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
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
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<title>VanillaClickOutside</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover" />
<meta name="description"
content="A simple easy to script to determine whenever the user clicks outside a selected element." />
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=ZCOOL+KuaiLe&display=swap" />
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous">
<link rel="stylesheet" href="./demo.css" />
<script defer src="./vanilla-click-outside.umd.js"></script>
<script defer src="./demo.js"></script>
<script type="module">
import modernVanillaClickOutside from './vanilla-click-outside.modern.js'
modernVanillaClickOutside(document.getElementById('inner'), (type) => {
handleCallback("modern", type)
}, {
removeListener: false
})
</script>
</head>
<body>
<header>
<h1>VanillaClickOutside</h1>
<p>Click anywhere in the viewport to see the magic. More verbose information
in the console.</p>
</header>
<main>
<section name="demo">
<div class="container">
<div class="row">
<div class="col-12">
<div class="root" id="root" data-title="root">
<div class="inner" id="inner" data-title="inner"></div>
</div>
</div>
</div>
</section>
<section name="log" class="mt-4">
<div class="container">
<div class="row">
<div class="col-12">
<table class="table table-bordered">
<thead>
<tr>
<th>Selector</th>
<th>Outside</th>
</tr>
</thead>
<tbody>
<tr class="rootGetElementById">
<td class="null">null</td>
<td class="null">null</td>
</tr>
<tr class="innerGetElementById">
<td class="null">null</td>
<td class="null">null</td>
</tr>
<tr class="rootGetElementsByClassName">
<td class="null">null</td>
<td class="null">null</td>
</tr>
<tr class="innerGetElementsByClassName">
<td class="null">null</td>
<td class="null">null</td>
</tr>
<tr class="rootQuerySelector">
<td class="null">null</td>
<td class="null">null</td>
</tr>
<tr class="innerQuerySelector">
<td class="null">null</td>
<td class="null">null</td>
</tr>
<tr class="rootQuerySelectorAll">
<td class="null">null</td>
<td class="null">null</td>
</tr>
<tr class="innerQuerySelectorAll">
<td class="null">null</td>
<td class="null">null</td>
</tr>
<tr class="modern">
<td class="null">null</td>
<td class="null">null</td>
</tr>
<tr class="undefinedTypeOf">
<td class="null">null</td>
<td class="null">null</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
</main>
</body>
</html>