$('#element').each(function() {
var timeout,
longtouch;
$(this).bind('touchstart', function() {
timeout = setTimeout(function() {
longtouch = true;
}, 1000);
}).bind('touchend', function() {
if (longtouch) {
// It was a long touch.
}
longtouch = false;
clearTimeout(timeout);
});
});
jsFiddle.
The fiddle works with a long click.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…