Jump to content

  • Log In with Google      Sign In   
  • Create Account

DarkZlayer

Member Since 30 Nov 2005
Offline Last Active Jan 08 2012 07:46 AM

#4885506 [web] HTML5 Platform Independent 'mousemove' ?

Posted by DarkZlayer on 18 November 2011 - 09:03 PM

I don't know a lot about cross browser compatability, but one thing you should do to help ease the pain is to have each browser just pass in their respective x,y into functions that actually handle it:

Instead of duplicating code do this:

function FirefoxMouseMove(e) {
	HandleMouseMove(e.pageX, e.pageY);
}

function ChromeMouseMove(e){
	HandleMouseMove(e.clientX, e.clientY);
}

function HandleMouseMove(x,y) {
	document.getElementById("x").innerHTML="clientX: "+x;
        document.getElementById("y").innerHTML="clientY: "+y;
}
Sorry I cannot help more than that, but hopefully it's better than nothing..


PARTNERS