aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/scrolls.js25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/content/scrolls.js b/src/content/scrolls.js
index a307aa7..f3124a1 100644
--- a/src/content/scrolls.js
+++ b/src/content/scrolls.js
@@ -62,31 +62,24 @@ class Scroller {
}
scrollTo(x, y) {
- let behavior = this.smooth ? 'smooth' : 'auto';
- window.scrollTo({
- left: x,
- top: y,
- behavior: behavior,
- });
if (!this.smooth) {
+ this.element.scrollTo(x, y);
return;
}
- this.prepareReset();
- }
-
- scrollBy(x, y) {
- let behavior = this.smooth ? 'smooth' : 'auto';
- window.scrollBy({
+ this.element.scrollTo({
left: x,
top: y,
- behavior: behavior,
+ behavior: 'smooth',
});
- if (!this.smooth) {
- return;
- }
this.prepareReset();
}
+ scrollBy(x, y) {
+ let left = this.element.scrollLeft + x;
+ let top = this.element.scrollTop + y;
+ this.scrollTo(left, top);
+ }
+
prepareReset() {
scrolling = true;
if (lastTimeoutId) {