forked from taufik-nurrohman/tag-picker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtag-picker.mark.html
36 lines (31 loc) · 886 Bytes
/
tag-picker.mark.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
<!DOCTYPE html>
<html dir="ltr">
<head>
<meta charset="utf-8">
<meta content="width=device-width" name="viewport">
<title>Tag Picker</title>
<link href="tag-picker.min.css" rel="stylesheet">
<style>
.tag-picker .tag.highlight {
background: #0f0;
}
</style>
</head>
<body>
<p>Add <em>foo</em> again to see the effect:</p>
<p><input type="text" value="foo, bar, baz"></p>
<script src="tag-picker.min.js"></script>
<script>
var picker = new TP(document.querySelector('input'));
picker.on('has.tag', function(tag, index) {
var node = this.view.querySelector('[title="' + tag + '"]');
if (node) {
node.classList.add('highlight');
setTimeout(function() {
node.classList.remove('highlight');
}, 2000);
}
});
</script>
</body>
</html>