简体   繁体   中英

Why does the JavaScript scroll() function behave in reverse?

From this thread: Vertical Scroll down and scroll up in Selenium WebDriver with java

I understand that scroll(xpos, ypos) needs:

  • positive value - scroll down
  • negative value - scroll up

However, isn't it that in the Cartesian Plane, down is negative for y-axis? 在此处输入图片说明

If anyone can clarify, that would be great. Thanks!

I think, I have found a highly relevant reading and also proof:

Why is the origin in computer graphics coordinates at the top left?

And since browsers display through a monitor, the same applies.

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