【发布时间】:2015-08-11 17:11:43
【问题描述】:
$(document).ready(function() {
var score = 0;
$("body").mousemove(function() {
score++;
$("#result").val(score);
console.log(score);
});
});
每次移动鼠标分数都会增加,但是我应该如何添加一个函数来减少分数直到鼠标不移动时分数为0?
【问题讨论】:
-
使用
setTimeout或setInterval。
标签: javascript jquery html web