2

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..

can anyone help me out?

Sachin
  • 2,152
  • 1
  • 21
  • 43
Arka
  • 65
  • 9
  • 1
    [This is an old problem.](https://stackoverflow.com/questions/1830080/jquery-scrolltop-doesnt-seem-to-work-in-safari-or-chrome-windows) – Pointy Oct 04 '17 at 14:12

1 Answers1

2

Use document.documentElement.scrollTop to return scroll position value

Update: Use both

var value = document.body.scrollTop || document.documentElement.scrollTop;
Muthu Kumaran
  • 17,682
  • 5
  • 47
  • 70