scrollTop()在firefox和chrome中有所不同
scrollTop() different in firefox vs chrome
我想要窗口的整个可滚动高度。然而,chrome在不滚动的情况下返回用户可见部分的长度,而firefox则返回整个可滚动长度。如何在不首先检测浏览器的情况下修复这种不一致性。目前我正在使用
$(window).scrollTop()
$(window).scrollTop()
在两者中的工作原理相同,它"告诉"您向下滚动了多远。
$(window).height()
给出视口的高度。
$(document).height()
给出了我认为您正在寻找的文档的高度。
或者,如果您只在视口外查找滚动高度,则
$(document).height() - $(window).height()
相关文章:
- Chrome WebKitGetUserMedia
- JQueryhide()不适用于Mozzilla,但适用于Chrome
- 在chrome.tabs.onCreated之后加载HTML页面
- chrome扩展中的navigator.geolocation.getCurrentPosition
- chrome扩展:尽管运行了at:documentidle,js脚本还是过早启动
- document.open/document.write没有正确地清除chrome中的文档——这是chrome的错误吗
- chrome扩展更改主机/域警告
- Chrome开发工具(如何知道我在调用哪个javascript对象)
- 如何在chrome扩展中重定向到html页面
- Chrome扩展没有't在重新加载之前考虑期权价值
- Google/html5语音识别JavaScript SDK Chrome网络工具包SpeechRecognition
- Jquery-Regex按键操作在Chrome和Firefox中有所不同
- scrollTop()在firefox和chrome中有所不同
- Mac Chrome 悬停事件在窗口最大化时的行为会有所不同
- 在 Firefox 和 Chrome 中,单击 iFrame 中的锚点的行为会有所不同
- 在 ASP.Net 发布模式下投放内容时,Chrome 的呈现方式会有所不同
- React 原生行为在模拟器/设备上/有或没有Chrome调试时有所不同
- Paper.js代码在Chrome开发工具中看起来有所不同
- 当弹出窗口被检查时,Google Chrome的行为会有所不同
- javascript中的日期解析在safari和chrome中有所不同