-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
50 lines (45 loc) · 1.41 KB
/
test.html
File metadata and controls
50 lines (45 loc) · 1.41 KB
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
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<style>
.btns {
text-wrap: nowrap;
overflow: hidden; width: 100px; height: 20px; border: 1px solid red
}
</style>
</head>
<body>
<div class="wrap">
<br /><br /><br /><br /><br /><br /><br />
<div class="btns" tabindex="0">
<a href="#" role="button">btn 1</a>
<a href="#" role="button">btn 2</a>
<a href="#" role="button">btn 3</a>
<a href="#" role="button">btn 4</a>
</div>
<div class="trace"></div>
</div>
<script>
$(function () {
const btns = document.querySelector('.btns')
const a = document.querySelector('a')
btns.addEventListener("scroll", (e) => {
trace(`btns - ${e.type}`)
});
btns.addEventListener('focus', (e) => {
trace(`btns - ${e.type}`)
})
a.addEventListener('focus', (e) => {
trace(`${e.target.textContent} - ${e.type}`)
})
a.addEventListener('blur', (e) => {
trace(`${e.target.textContent} - ${e.type}`)
})
})
function trace(msg) {
$('.trace').append(`<p>${msg}</p>`)
}
</script>
</body>
</html>