[jQuery] IE 2px out on event.pageX/Y

[jQuery] IE 2px out on event.pageX/Y


Has anyone come across this before, coz it's been driving me nuts!
IE7 and IE6 are both reporting the cursor position as 2px greater - both X
and Y - than the actual position, say, of a div on the screen.
For example, given an absolutely positioned div at 100(top), 200(left), with
a mousemove event bound to document, returns event.pageX of 202 and
event.pageY of 102 when the cursor is placed at the top left hand corner of
the div.
Firefox and Opera work perfectly and return 200 and 100 respectively!
Demonstration at http://www.wizzud.com/tester http://www.wizzud.com/tester
- document is XHTML strict, but the same thing happens with HTML 40.1
transitional, so it's not the doctype! If you put the cursor (I set it to
crosshair to make it easier) at the top left hand corner of either grey area
it will report pageX/Y 2px out in IE, but on the money in Firefox/Opera. To
get IE to report 0,0 you actually have to go off the edge of the screen!
I looked into the fix code in jQuery but that is no solution because it just
uses clientX/Y, which (as shown on the demo) are wrong.
Basically, I can't see any way of accurately determining the cursor position
cross-browser without putting in a specific fix for IE!
Can anyone else help?
--
View this message in context: http://www.nabble.com/IE-2px-out-on-event.pageX-Y-tf4384471s15494.html#a12499347
Sent from the JQuery mailing list archive at Nabble.com.