This commit is contained in:
Lazy Hippopotamus
2023-07-06 14:06:25 -04:00
parent 48d4c2cc5d
commit 231045983a
5 changed files with 80 additions and 56 deletions

16
main.js
View File

@@ -1,3 +1,19 @@
var startX = 0;
window.ontouchstart = (evt) => {
startX = evt.touches[0].clientX;
}
window.ontouchmove = (evt) => {
var difX = evt.touches[0].clientX - startX;
if (difX > 100) {
document.body.classList.add("sidebar-opened");
}
if (difX < -100) {
document.body.classList.remove("sidebar-opened");
}
}
function clamp(min, val, max) {
if (val < min) {
val = min;