-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
49 lines (40 loc) · 903 Bytes
/
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
<html>
<head>
<title>switcher component</title>
<style>
li, #another {
cursor: pointer;
}
.is-selected {
background: blue;
}
</style>
</head>
<body>
<h1>switcher component</h1>
<ul>
<li>hi</li>
<li>hello</li>
<li>whats up</li>
<li>whatever</li>
<li>cool</li>
</ul>
<div id="another">another div</div>
<script src="../build/build.js" type="text/javascript"></script>
<script type="text/javascript">
var Switch = require('switcher');
var switcher = Switch(),
items = document.querySelectorAll('li');
for (var i = 0, len = items.length; i < len; i++) {
switcher.add(items[i], function() {
console.log('lol....');
});
};
switcher.add(another);
setTimeout(function() {
console.log('removing another');
switcher.remove(another)
}, 3000);
</script>
</body>
</html>