-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscrollToEle.html
82 lines (80 loc) · 2.13 KB
/
scrollToEle.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Scroll滚动</title>
<style>
* {
padding: 0;
margin: 0;
}
body {
height: 1600px;
width: 100%;
}
.container {
height: 800px;
width: 1000px;
margin: 100px auto;
overflow-y: scroll;
border: 2px solid #222;
}
.line1 {
height: 400px;
border: 10px solid #FB0A0A;
padding: 20px;
background-color: antiquewhite;
}
.line2 {
height: 500px;
background-color: #95FB0A;
border: 10px solid #FB0AAE;
padding: 20px;
}
.line3 {
height: 600px;
background-color: #FBA30A;
border: 10px solid #200AFB;
padding: 20px;
}
.rect {
border: 1px solid #222;
width: 100%;
height: 100%;
}
.outer-content {
position: fixed;
left: 0;
top: 0;
right: 0;
}
#update-pos-button {
cursor: pointer;
z-index: 100;
}
</style>
</head>
<body>
<p class="outer-content">body content</p>
<div class="container" id="content-container">
<div class="line1">
<div class="rect rect1"></div>
</div>
<div class="line2">
<div class="rect rect2"></div>
</div>
<div class="line3">
<div class="rect rect3"></div>
</div>
</div>
<img src="./iamges/boundrect.png" width="400"/>
<img src="./iamges/box.png" width="400">
<img src="./iamges/clientHeight.png" width="400">
<img src="./iamges/offsetHeight.png" width="400">
<img src="./iamges/scrollHeight.png" width="400">
<img src="./iamges/scrolltop.png" width="400">
<script src="./11-scoll-to-ele.ts" type="module"></script>
</body>
</html>