为什么要引入 window.scrollY 和 window.scrollX? [英] Why were window.scrollY and window.scrollX introduced?

查看:31
本文介绍了为什么要引入 window.scrollY 和 window.scrollX?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,pageXOffset/pageYOffset 属性自 Netscape 4 时代就已经可用.
似乎 scrollX/scrollY 是在大约 Netscape 6 中引入的.

As far as I know, pageXOffset/pageYOffset properties were already available since Netscape 4 era.
And it seems scrollX/scrollY were introduced circa Netscape 6.

替代问题:

第 2 季度.有没有实现scrollX/scrollY但不支持pageXOffset/pageYOffset的浏览器?

Q2. Is there a browser which implements scrollX/scrollY but doesn't support pageXOffset/pageYOffset?

我将添加第三个问题,因为没有人能够回答之前的问题:

I will add a third question because no one was able to answer the previous ones:

第三季度.最新的CCSOM编辑草稿中增加了scrollX/scrollY,工作草稿只有pageXOffset/pageYOffset,为什么还要保留这两个属性?

Q3. scrollX/scrollY was added to the latest editor's draft of the CCSOM and the working draft only got pageXOffset/pageYOffset, why are they keeping both attributes?

推荐答案

是否有实现scrollY/X但不支持pageY/XOffset的浏览器

Is there a browser which implements scrollY/X but doesn't support pageY/XOffset

我想您想知道的是您是否可以完全信任 pageY/XOffset 并将 scrollY/X 排除在游戏之外.答案是肯定的.pageY/XOffset 适用于 Firefox、Chrome、Opera 和 IE 9!

I guess what you want to know is whether you can fully trust pageY/XOffset and leave scrollY/X out of the game. The answer is yes. pageY/XOffset is working in Firefox, Chrome, Opera, and IE 9!

我目前无法在 IE9 上测试 scrollX/Y,但它未在 MSDN 属性 所以它很有可能回答你的问题.所以可能有浏览器实现了 pageY/XOffset 而不是 scrollY/X.

I can't test scrollX/Y on IE9 currently, but it is not listed on MSDN properties so there is a good chance it answers your question. So there may be browsers implementing pageY/XOffset but not scrollY/X.

为什么引入 window.scrollY 和 window.scrollX?

Why were window.scrollY and window.scrollX introduced?

因为 scrollY 只是一个 别名,我确定它只是为了更好的可读性.

As scrollY is only an alias, I'm sure it is only for better readability.

这篇关于为什么要引入 window.scrollY 和 window.scrollX?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆