Skip to main content

Bug Tracker

Side navigation

#445 closed enhancement (fixed)

Opened November 28, 2006 04:41PM UTC

Closed November 30, 2006 08:39PM UTC

Last modified June 20, 2007 02:13AM UTC

normalise pageX/pageY

Reported by: sam Owned by:
Priority: major Milestone:
Component: core Version:
Keywords: Cc:
Blocked by: Blocking:
Description

As Internet Explorer does not support pageX and pageY it would be useful if the properties could still be used. The workaround I use at the moment is:

if(!event.pageX)
{
	event.pageX = event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft);
	event.pageY = event.clientY + (document.documentElement.scrollTop || document.body.scrollTop);
}

Works with no problems in IE7, Firefox 2 and Opera 8.5.

Attachments (0)
Change History (7)

Changed November 29, 2006 08:25PM UTC by joern comment:1

Is there any browser apart from IE that doesn't provide pageX natively?

I'd rewrite the code a little:

if(!event.pageX) {
  var e = document.documentElement, b = document.body;
  event.pageX = event.clientX + (e.scrollLeft || b.scrollLeft);
  event.pageY = event.clientY + (e.scrollTop || b.scrollTop);
}

Changed November 29, 2006 09:45PM UTC by anonymous comment:2

This would be very helpful indeed

Changed November 29, 2006 09:49PM UTC by Geoffreyk comment:3

If I had a dollar for everytime I have written this function....

I think this should be added to 1.1

Changed November 30, 2006 02:13AM UTC by andrea ercol comment:4

good

Changed November 30, 2006 07:48AM UTC by paul.bakaus@ comment:5

Very nice! I'm definitely for it.

Changed November 30, 2006 04:48PM UTC by Alex Cook comment:6

Yes please :)

Changed November 30, 2006 08:39PM UTC by joern comment:7

resolution: → fixed
status: newclosed

Fixed in SVN.