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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -