aboutsummaryrefslogtreecommitdiff
path: root/src/content/scrolls.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-08-27 10:21:07 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-08-27 10:21:07 +0900
commit20e66ea2c7aa68dd5ffdb1af939e04d799969d90 (patch)
treebb1a2e8200cd8bb7cbd8e0a0dfa0a9268b167398 /src/content/scrolls.js
parent02c0cfd97d44c8568dee6f0d11d2e45732309c67 (diff)
scroll by pages
Diffstat (limited to 'src/content/scrolls.js')
-rw-r--r--src/content/scrolls.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/content/scrolls.js b/src/content/scrolls.js
index ef112a4..540703e 100644
--- a/src/content/scrolls.js
+++ b/src/content/scrolls.js
@@ -6,6 +6,13 @@ const scrollLines = (page, count) => {
page.scrollTo(x, y);
};
+const scrollPages = (page, count) => {
+ let height = page.innerHeight;
+ let x = page.scrollX;
+ let y = page.scrollY + height * count;
+ page.scrollTo(x, y);
+};
+
const scrollTop = (page) => {
let x = page.scrollX;
let y = 0;
@@ -18,4 +25,4 @@ const scrollBottom = (page) => {
page.scrollTo(x, y);
};
-export { scrollLines, scrollTop, scrollBottom }
+export { scrollLines, scrollPages, scrollTop, scrollBottom }