JavaScript - scrollTop
Table of Contents
#
JavaScript - scrollTop
##
scrollTop
Element.scrollTop - Web API Interfaces | MDN
##
Issue in firefox
Normal
element.scrollTop = intValue;
But when I use
document.body.scrollTop = 0;
It doesn’t work in firefox.
Solution
document.documentElement.scrollTop = 0; // for firefox
Refer - document.body.scrollTop vs document.documentElement.scrollTop