Remove mobile touch detection (broken)
This commit is contained in:
parent
e2b2e3bb70
commit
ef924e201e
31
script.js
31
script.js
@ -182,33 +182,4 @@ function slideProjects() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For mobile - whenever the user slides left or right on the screen in the projects
|
|
||||||
// section, slide to the next or previous project
|
|
||||||
projects.addEventListener('touchend', function (e) {
|
|
||||||
// Get the touch position
|
|
||||||
touchEndX = e.changedTouches[0].pageX;
|
|
||||||
|
|
||||||
if (touchStartX > touchEndX) {
|
|
||||||
let checked = document.querySelector('input[name="slider"]:checked');
|
|
||||||
let next = checked.nextElementSibling;
|
|
||||||
|
|
||||||
if (next.nodeName === 'DIV') {
|
|
||||||
document.querySelector('input[name="slider"]').checked = true;
|
|
||||||
} else if (next) {
|
|
||||||
next.checked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (touchStartX < touchEndX) {
|
|
||||||
let checked = document.querySelector('input[name="slider"]:checked');
|
|
||||||
let prev = checked.previousElementSibling;
|
|
||||||
|
|
||||||
if (prev) {
|
|
||||||
prev.checked = true;
|
|
||||||
} else {
|
|
||||||
document.querySelector('input[name="slider"]:last-of-type').checked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user