Jquery document off mouseevent -
start
$(document).on('mousemove', "#id", event);
disable
$(document).off('mousemove', "#id");
i have tried...
$(document).off('mousemove', "#id", event); $("#id").unbind('mousemove');
exact functions
$(document).on('click', "#id", function (e) { $(document).on('mousemove', "#id", event); }); $(document).on('mouseup', function () { console.log('test'); $(document).off('mousemove', "#id"); });
what doing wrong?
use mousedown instead of click since click
fired after mouseup
$(document).on('mousedown', "#id", function (e) { console.log('register') $(document).on('mousemove', "#id", event); }); $(document).on('mouseup', function () { console.log('test'); $(document).off('mousemove', "#id", event); });
demo: fiddle
Comments
Post a Comment