Reputation: 729
I've got a mousedown function. How can I stop the function when the mouse is released?
$('#manRun').mousedown(function(e3) {
var manID = get_id(this);
e3.preventDefault();
$(document).on('mousemove.moveMan', function(e2) {
runing(e2, runBtn, manID);
});
});
Upvotes: 1
Views: 102
Reputation: 1156
Create another function for mouseup
then unattach the handler.
$('#manRun').on('mouseup', function(e) {
e.preventDefault();
$(document).off('mousemove.moveMan');
});
Upvotes: 2