parent
8e5ceebf61
commit
6bdacc7758
3 changed files with 56 additions and 3 deletions
@ -0,0 +1,27 @@ |
||||
const SCROLL_DELTA = 48; |
||||
|
||||
const scrollUp = (page) => { |
||||
let x = page.scrollX; |
||||
var y = page.scrollY - SCROLL_DELTA; |
||||
page.scrollTo(x, y); |
||||
}; |
||||
|
||||
const scrollDown = (page) => { |
||||
let x = page.scrollX; |
||||
var y = page.scrollY + SCROLL_DELTA; |
||||
page.scrollTo(x, y); |
||||
}; |
||||
|
||||
const scrollToTop = (page) => { |
||||
let x = page.scrollX; |
||||
var y = page.scrollMaxY; |
||||
page.scrollTo(x, y); |
||||
}; |
||||
|
||||
const scrollToBottom = (page) => { |
||||
let x = page.scrollX; |
||||
var y = 0; |
||||
page.scrollTo(x, y); |
||||
}; |
||||
|
||||
export { scrollUp, scrollDown, scrollToTop, scrollToBottom } |
Reference in new issue