-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathviewPortTest.html
71 lines (68 loc) · 1.57 KB
/
viewPortTest.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.v8{
margin: 0;
height: 10vh;
}
div:nth-child(1){
background-color: #1b6d85;
width: 50vw;
font-size: 3vh;
}
div:nth-child(2){
background-color: navajowhite;
}
div:nth-child(3){
background-color: aqua;
}
div:nth-child(4){
background-color: royalblue;
}
div:nth-child(5){
background-color: crimson;
}
div:nth-child(6){
background-color: #1b6d85;
font-size: 3vh;
}
div:nth-child(7){
background-color: navajowhite;
}
div:nth-child(8){
background-color: aqua;
}
div:nth-child(9){
background-color: royalblue;
}
div:nth-child(10){
background-color: crimson;
}
div:nth-child(11){
background-color: hotpink;
}
</style>
</head>
<body style="margin: 0">
<div class="v8">111111</div>
<div class="v8">2</div>
<div class="v8">3</div>
<div class="v8">4</div>
<div class="v8">5</div>
<div class="v8">111111</div>
<div class="v8">2</div>
<div class="v8">3</div>
<div class="v8">4</div>
<div class="v8">5</div>
<div class="v8">11</div>
<script>
window.onscroll = function(){
let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
console.log(scrollTop)
}
</script>
</body>
</html>