简体   繁体   中英

Raphael.js: How to unbind mousemove on set()?

I have this code with Raphael.js:

var set = paper.set();
// ... here push some elements to set: path, circles, etc.
set.mousedown(function() { ... });
set.mousemove(function() { ... });
set.mouseup(function() { ... });

Everything works fine... but how to do unbind .mousemove event on "set" and bind again?

Add un before the event name http://raphaeljs.com/reference.html#Element.unmousemove

// Pass the handler to install it
set.mousemove(handler);
// Pass the same handler to remove it
set.unmousemove(handler);

Raphael JS : how to remove events?

You can't pass in an anonymous function as you did, because you have to pass a reference to the function when removing a handler

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM