鼠标按住的事件处理方式。 From http://segmentfault.com/q/1010000000267088#a-1020000000303243
var interval;
$('div').mousedown(mouseState).mouseup(mouseState);
function mouseState(e) {
if (e.type == "mouseup") {
clearInterval(interval);
}
if (e.type == "mousedown") {
//code triggers on hold
interval = setInterval(function () {
$('div').prepend("<span>hold</span>")
}, 100);
}
}