[英]Why body.scrollTop is not working on Google chrome and Firefox but working on Microsoft edge
Previously body.scrollTop
was working in my chrome.....but suddenly body.scrollTop
is returning 0 in firefox and chrome......but returning proper value in Microsoft edge..以前
body.scrollTop
在我的 chrome 中工作......但突然body.scrollTop
在 firefox 和 chrome 中返回 0......但在 Microsoft Edge 中返回正确的值......
can anyone help me out?谁能帮我吗?
Use document.documentElement.scrollTop
to return scroll position value使用
document.documentElement.scrollTop
返回滚动位置值
Update: Use both更新:同时使用
var value = document.body.scrollTop || document.documentElement.scrollTop;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.