-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare.js
30 lines (29 loc) · 853 Bytes
/
prepare.js
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
const executeInterval = 500
let scrollArea = document.querySelector("#note-list-block")
let change = true
let totop = true
let lastScrollTop = -1
let k = 0
const id = setInterval(() => {
if (lastScrollTop !== scrollArea.scrollTop) {
lastScrollTop = scrollArea.scrollTop
scrollArea.scrollBy(0, 100000)
console.log("scroll more")
} else if (change) {
if (!document.querySelector("#virtual-note-list-id")) {
console.log("virtual scroll area not found")
change = false
return
}
scrollArea = document.querySelector("#virtual-note-list-id")
scrollArea.scrollBy(0, 100000)
change = false
console.log("change scroll area")
} else if (totop) {
scrollArea.scrollTo(0, -1)
totop = false
console.log("scroll to top")
console.log("scroll end")
clearInterval(id)
}
}, executeInterval)