jeudi 28 mai 2015

How to make function work when the mouse not moving?

$(document).ready(function() {
var score = 0;

$("body").mousemove(
function(){

score ++;

$("#result").val(score);

console.log(score);
    }

  );

 }

);

The score will increase every time when I move the mouse, but how to add a function of the score keep decrease until to 0 when the mouse is not moving?




Aucun commentaire:

Enregistrer un commentaire