/
scrollable.html
40 lines (40 loc) · 1.27 KB
/
scrollable.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
<!DOCTYPE html>
<html>
<head>
<title>Scrollable test</title>
</head>
<body>
<script src='mouse-helper.js'></script>
<script>
for (let i = 0; i < 100; i++) {
let button = document.createElement('button');
button.textContent = i + ': not clicked';
button.id = 'button-' + i;
button.onclick = () => button.textContent = 'clicked';
button.oncontextmenu = event => {
if (![2].includes(event.button)) {
return;
}
event.preventDefault();
button.textContent = 'context menu';
}
button.onauxclick = event => {
if (![1].includes(event.button)) {
return;
}
event.preventDefault();
button.textContent = 'aux click';
}
button.onmouseup = event => {
if (![3,4].includes(event.button)) {
return;
}
event.preventDefault();
button.textContent = event.button === 3 ? 'back click' : 'forward click';
}
document.body.appendChild(button);
document.body.appendChild(document.createElement('br'));
}
</script>
</body>
</html>