Frontend: Improve touch event listeners #242

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-03-24 17:01:57 +01:00
parent c19cefd5df
commit 6b32598c3b
2 changed files with 6 additions and 4 deletions

View file

@ -340,10 +340,11 @@
}, },
onTouchMove(e) { onTouchMove(e) {
const y = e.touches[0].pageY; const y = e.touches[0].pageY;
const h = window.document.documentElement.scrollHeight - window.document.documentElement.clientHeight;
if(window.scrollY >= window.innerHeight && y < this.touchStart + 200) { if(window.scrollY >= h - 200 && y < this.touchStart + 100) {
this.loadMore(); this.loadMore();
} else if (window.scrollY === 0 && y > this.touchStart + 200) { } else if (window.scrollY === 0 && y > this.touchStart + 250) {
this.refresh(); this.refresh();
} }
}, },

View file

@ -339,10 +339,11 @@
}, },
onTouchMove(e) { onTouchMove(e) {
const y = e.touches[0].pageY; const y = e.touches[0].pageY;
const h = window.document.documentElement.scrollHeight - window.document.documentElement.clientHeight;
if(window.scrollY >= window.innerHeight && y < this.touchStart + 200) { if(window.scrollY >= h - 200 && y < this.touchStart + 100) {
this.loadMore(); this.loadMore();
} else if (window.scrollY === 0 && y > this.touchStart + 200) { } else if (window.scrollY === 0 && y > this.touchStart + 250) {
this.refresh(); this.refresh();
} }
}, },