/
scroll-automations.html
99 lines (87 loc) · 2.28 KB
/
scroll-automations.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>scroll automations</title>
<style>
* {
padding: 0;
margin: 0;
}
#wrapper {
height: 5000px;
width: 5000px;
}
#scrollable {
height: 500px;
width: 500px;
overflow: scroll;
border: 1px solid black;
}
#hidden {
height: 500px;
width: 500px;
overflow: hidden;
border: 1px solid black;
}
#scrollable-deferred {
height: 500px;
width: 500px;
overflow: scroll;
margin-top: 1000px;
}
#scrollable-deferred > div {
height: 5000px;
width: 5000px;
position: relative;
}
#target {
width: 1000px;
height: 1000px;
background-color: black;
top: 700px;
left: 700px;
position: absolute;
}
#hidden-target {
width: 1000px;
height: 1000px;
background-color: black;
top: 700px;
left: 700px;
position: absolute;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="scrollable">
<div style="height: 5000px; width: 5000px; position: relative;">
<div id="target"></div>
</div>
</div>
<div id="hidden">
<div style="height: 5000px; width: 5000px; position: relative;">
<div id="hidden-target"></div>
</div>
</div>
</div>
<script>
setTimeout(function () {
var div = document.createElement('div');
div.id = 'scrollable-deferred';
div.appendChild(document.createElement('div'));
document.getElementById('wrapper').appendChild(div);
}, 3000);
var target = document.getElementById('target');
function handler () {
throw new Error('should not raise mouse events');
}
target.addEventListener('mouseenter', handler);
target.addEventListener('mouseleave', handler);
target.addEventListener('mouseover', handler);
target.addEventListener('mouseout', handler);
target.addEventListener('mousemove', handler);
</script>
</body>
</html>