javascript - Should I / how do I clear a mousemove JQuery event listener? -
when use
$(".page").mousemove(function(event){});   as mouseup event comes, no longer need listener. since i'll applying listener repetitively different actions, seems me these listeners might stick around , build (needlessly wasting cpu) user activates function many times. i'm not sure how works internally, that's guess. 
should / how clear mousemove jquery event listener?
here code:
$('.page').off('mousemove');   but please note following approach turns off functions firing on mousemove. if want turn off prticular function should following:
// define function fires on mousemove function anyfunctionname () {     // code }  // set listener $('.page').on('mousemove', anyfunctionname);  // turn off function called funcionname $('.page').off('mousemove', anyfunctionname);   another way turning off particular function defining name event:
// define function fires on mousemove function anyfunctionname () {     // code }  // set listener $('.page').on('mousemove.anyeventname', anyfunctionname);  // turn off function fired on event called anyeventname $('.page').off('mousemove.anyeventname');      
Comments
Post a Comment