-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheventhandling.html
More file actions
49 lines (42 loc) ยท 1.88 KB
/
Copy patheventhandling.html
File metadata and controls
49 lines (42 loc) ยท 1.88 KB
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
<!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>Document</title>
<script>
//window์ Load์ด๋ฒคํธ๋
//ํ์ผ์ ์ ๋ถ ์ฝ์ด์ ํ๊ทธ๋ค์ ์ ๋ถ ๋ฉ๋ชจ๋ฆฌ์ ์ ์ฌํ ํ์ ๋ฐ์
window.addEventListener("load",(e)=>{
document.getElementById("display").innerHTML = "์ด๋ฒคํธ ์ฒ๋ฆฌ"
for(let i=0; i < 100; i++){
document.getElementById("body").innerHTML += "<h1>๋ฌดํ์คํฌ๋กค</h1>"}
window.addEventListener("scroll", (e)=>{
//์คํฌ๋กคํ๋ ์์น์ ๋ฌธ์์ ๋์ด๊ฐ ๊ฐ์ ๋
//๊ฐ์ฅ ์๋์์ ์คํฌ๋กค์ ํ ๋
//์คํฌ๋กค ํ๋ ๊ฐ์ฅ ๋์ ์์น๋ฅผ ๊ฐ์ ธ์ค๊ธฐ
var supportPageOffset = window.pageXOffset !== undefined;
var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat")
var scrollTop = supportPageOffset ? window.pageYOffset :
isCSS1Compat ? document.documentElement.scrollTop :
document.body.scrollTop;
//์คํฌ๋กคํ๋ ๋์ด
var scrollHeight = scrollTop + window.innerHeight
//๋ฌธ์์ ๋์ด
var documentHeight = document.body.clientHeight;
//์คํฌ๋กค ํ๋ ์์น๊ฐ ๋ฌธ์์ ๋์ด๋ณด๋ค ํฌ๊ฑฐ๋ ๊ฐ์ผ๋ฉด ๊ณ์ ์ ๋ณด ์์ฑ
if(scrollHeight >= documentHeight){
for(let i=0; i<30; i++){
document.getElementById("body").innerHTML += "<h1>๋ฌดํ์คํฌ๋กค</h1>"
}
}
})
})
</script>
</head>
<body>
<div id="display"></div>
<div id="body"></div>
</body>
</html>