javascript - stop function on mouseup -
i've got mousedown function.
$('#manrun').mousedown(function(e3) { var manid = get_id(this); e3.preventdefault(); $(document).on('mousemove.moveman, mousemove.slideman', function(e2) { running(e2, runbtn, manid); }); });
and mouseup function stop running()
$('#manrun').on('mouseup', function(e) { e.preventdefault(); $(document).off('mousemove.moveman, mousemove.slideman'); });
but running()
function not stop. how can force running()
stop when mouse released?
i assume mouseup not done on #manrun object. try attach handler document instead.
$(document).on('mouseup', function(e) { e.preventdefault(); $(document).off('mousemove.moveman, mousemove.slideman'); });
Comments
Post a Comment