-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnested.html
75 lines (71 loc) · 2.91 KB
/
nested.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="user-scalable=no,minimum-scale=1">
<style type="text/css">
body {
background-color: black;
}
#greenbox {
width: 100%;
height: 100px;
background: green;
padding: 0px;
margin: 0px;
}
#bluebox {
width: 200px;
height: 100px;
background: blue;
padding: 0px;
margin: 0px;
}
#redbox {
width: 200px;
height: 100px;
background: red;
padding: 0px;
margin: 0px;
}
</style>
<script>
function handler(ev) {
//console.log('InnerKeyEvent: Target[' + ev.target + '] CurrentTarget[' + ev.currentTarget +']');
}
function wheelHandler(ev) {
//console.log('InnerWheel: Target[' + ev.target + '] CurrentTarget[' + ev.currentTarget +']');
}
addEventListener('load', function() {
document.getElementById('container').addEventListener('keypress', handler);
document.getElementById('innerContainer').addEventListener('keypress', handler);
document.body.addEventListener('keypress', handler);
document.documentElement.addEventListener('keypress', handler);
document.getElementById('container').addEventListener('wheel', wheelHandler);
document.getElementById('innerContainer').addEventListener('wheel', wheelHandler);
document.body.addEventListener('wheel', wheelHandler);
document.documentElement.addEventListener('wheel', wheelHandler);
if (document.setRootScroller)
document.setRootScroller(document.getElementById('container'));
});
</script>
</head>
<body>
<div id="container" style="background-color: white; height: 500px; width: 300px; overflow-y: scroll">
<input type="text">
<div id="innerContainer" style="height: 300px; width: 200px; overflow-y: scroll">
<input type="text">
<div id="bluebox"></div><div id="redbox"></div>
<div id="bluebox"></div><div id="redbox"></div>
<div id="bluebox"></div><div id="redbox"></div>
<div id="bluebox"></div><div id="redbox"></div>
<div id="bluebox"></div><div id="redbox"></div>
</div>
<div id="greenbox"></div><div id="redbox"></div>
<div id="greenbox"></div><div id="redbox"></div>
<div id="greenbox"></div><div id="redbox"></div>
<div id="greenbox"></div><div id="redbox"></div>
</div>
<div style="width:100px; height:2000px; background: green;"></div>
<div style="width:100%; height: 100px; background-color: yellow; position: fixed; left: 0px; top: 0px;"></div>
</body>
</html>