• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

PageX and pageY for IE

Question

Default_flex    0

I want to know what are the pageX and pageY equivalents for IE. pageX and pageY work on firefox, they are great because they get the actual position of the mouse relative to the page and not the window like clientX and clientY. any suggestions?

thanks guys

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
The_Decryptor    1,105

QuirksMode has this script fragment

if (e.pageX || e.pageY) {
	posx = e.pageX;
	posy = e.pageY;
}
else if (e.clientX || e.clientY) {
	posx = e.clientX + document.body.scrollLeft
		+ document.documentElement.scrollLeft;
	posy = e.clientY + document.body.scrollTop
		+ document.documentElement.scrollTop;
}

e is the event, posx and posy now contain the pageX and pageY values, if IE supported them.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.