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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -