|
<li ontouchstart="touchstart(this)" ontouchend="touchend(this)" >
<scirpt>
var startTime = '';
var endTime = '';
function touchstart(el)
{
startTime = +new Date();
timer = setTimeout(function () {
alert("长按了");
}, 1000)
}
function touchend(el)
{
endTime = +new Date();
if (endTime - endTime < 1000)
{
clearTimeout(timer);
}
}
</script> |
|