Reputation: 3718
I wanted to catch long touch event using java script so I used touchstart and touchend but the scroll in the application is stopped . Is there is a way to catch long touch and keep scroll functionality working
var longpress;
$(document).ready(function(){
$("#element").on('touchstart' ,function(){
longpress=true;
setTimeout(function() {
if(longpress)
alert("long press works!");
}, 2000);
})
$("#element").on('touchend' ,function(){
longpress=false;
})
Upvotes: 1
Views: 612
Reputation: 3718
I found the solution to this problem using quo.js and here's the code after modification
$$('#element').hold(function(event) {
alert('long tab detected');
}
Upvotes: 2