简体   繁体   中英

Are event.pageX and event.pageY safe to use?

I am currently developing a web application that implements drag and drop and I need to retrieve the YPosition of where the element is dropped. This works fine using event.clientX & event.clientY until the screen has scollbars at which time these do not take into account the amount of space that is offscreen.

There is also the event.pageX and event.pageY properties which do contain this information but Mozilla page stated that these should not be as they are not standardized.

在此输入图像描述

From looking at a blog post by Jack Moore it appears that these properties may be part of a W3C Working Draft which might be this standards document .

I have tested my solution in IE11, Firefox and Chrome and it works in all browsers but what I was wondering is are pageX & pageY safe to use in a production web application?

除非你需要支持IE8,否则你可以使用它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM