im trying to make a function that an object follows the mouse everywhere on the screen, but when the mouse hovers a link, the mousemovement must stop, so the object that is following the mouse does not interfeer when clicking the link. To do that i created a #safe css to use as my links id. Im trying to unbind and bind the 'mousemove', it unbinds when mouse is over the link, but does not bind back when the mouse leaves the link. How can i solve that?
here my fiddle: http://jsfiddle.net/czdpY/
$('#safe').hover(
function () {
$(document).unbind('mousemove');
},
function () {
$(document).bind('mousemove');
}
);
You need to add the function names as well.
$('#safe').hover(
function () {
$(document).unbind('mousemove', boundFunction);
},
function () {
$(document).bind('mousemove', boundFunction);
}
);