我正在尝试将下面的函数分配给变量,以便将其绑定到另一个函数。这是原始功能
var timer = 0;
$(document).ready(function(e)
{
$(this).on("mousemove", function(e){
clearTimeout(timer);
console.log("TRUE mouse");
timer= setTimeout(function (e) { console.log("false mouse");
},"5000");
})
});
我尝试将上述函数分配给this.onMouseHandler,但它似乎不起作用。如何将上述函数分配给我可以绑定的变量呢?
this.onMouseHandler = function(e )
{var timer = 0;
$(this).on("mousemove", function( e ){
clearTimeout(timer);
console.log("true");
this.active = true;
timer= setTimeout(function () { console.log("false");
this.active = false;
},"5000");
}) };