Fix menu swiping
This commit is contained in:
parent
d9206c1087
commit
797731262a
@ -35,7 +35,7 @@ function onTouchStart(e) {
|
||||
return;
|
||||
}
|
||||
|
||||
const styles = window.getComputedStyle(this.menu);
|
||||
const styles = window.getComputedStyle(SlideoutMenu.menu);
|
||||
|
||||
menuWidth = parseFloat(styles.width);
|
||||
menuIsAbsolute = styles.position === "absolute";
|
||||
@ -65,7 +65,7 @@ function onTouchMove(e) {
|
||||
const devicePixelRatio = window.devicePixelRatio || 2;
|
||||
|
||||
if (Math.abs(distX) > devicePixelRatio) {
|
||||
this.viewport.classList.toggle("menu-dragging", true);
|
||||
SlideoutMenu.viewport.classList.toggle("menu-dragging", true);
|
||||
menuIsMoving = true;
|
||||
}
|
||||
}
|
||||
@ -85,8 +85,8 @@ function onTouchMove(e) {
|
||||
distX = 0;
|
||||
}
|
||||
|
||||
this.menu.style.transform = "translate3d(" + distX + "px, 0, 0)";
|
||||
this.sidebarOverlay.style.opacity = distX / menuWidth;
|
||||
SlideoutMenu.menu.style.transform = "translate3d(" + distX + "px, 0, 0)";
|
||||
SlideoutMenu.sidebarOverlay.style.opacity = distX / menuWidth;
|
||||
}
|
||||
|
||||
function onTouchEnd() {
|
||||
@ -99,9 +99,9 @@ function onTouchEnd() {
|
||||
|
||||
document.body.removeEventListener("touchmove", onTouchMove);
|
||||
document.body.removeEventListener("touchend", onTouchEnd);
|
||||
this.viewport.classList.toggle("menu-dragging", false);
|
||||
this.menu.style.transform = null;
|
||||
this.sidebarOverlay.style.opacity = null;
|
||||
SlideoutMenu.viewport.classList.toggle("menu-dragging", false);
|
||||
SlideoutMenu.menu.style.transform = null;
|
||||
SlideoutMenu.sidebarOverlay.style.opacity = null;
|
||||
|
||||
touchStartPos = null;
|
||||
touchCurPos = null;
|
||||
|
Loading…
Reference in New Issue
Block a user