This is the first time I'm working with touch events. What I'm making is a button to slide a side menu on a responsive web. The button should only show it a touchstart event exists and dissapear 500ms after the touchend event is triggered.
here is my code:
// EVENT LISTENERS
function touchDown(event) {
sliderButton.show();
}
function touchUp(event) {
sliderButton.hide();
}
if (isMobile.any()) {
sliderButton.hide();
window.addEventListener("touchstart", touchDown, false);
window.addEventListener("touchend", setTimeout(function() {
sliderButton.hide(); //I used to invoke the touchUp function and it also didin't work,
}, 500), false);
}
Also when I do touchmove (basically just move my finger areound the screen) it doesn't recognize the 'touchend' trigger. Any cluues on how to deal with thhis? Or should I open a new thread for that?
Thanks