var f = true; $elem.mousedown = function () { f = false } $elem.mouseup = function () { f = true } $elem.mousemove(function () { if(f)myfunc) }
$elem.on('mousedown', function () { $elem.on('mousemove', myfunc); }); $elem.on('mouseup', function () { $elem.off('mousemove', myfunc); });