I am trying to bind a mousemove event to the body. My attempts so far:
$('html, body').mousemove(function(event){...});
$('html, body')[0].onmousemove= function(event){...};
$('body').bind('mousemove', function(event){...});
document.onmousemove = function(event){...};
document.getElementsByTagName('body')[0].onmousemove = function(event){...};
EDIT:
window.onmousemove = function(event){...}; // doesn't work either
EDIT2: I need the whole body to be responsive, and not only nested elements.
All of these worked, but none did in IE.
How can I solve this?
You don’t want it in the body because body is not necessarily the full page.
jsfiddle: http://jsfiddle.net/uDfPj/
Alternatively without jQuery: