Home > front end >  The scroll bar height
The scroll bar height

Time:10-07

The function setScrollTop () {
Var scrollTop=0;
If (document. The documentElement & amp; & Document. The documentElement. ScrollTop) {
ScrollTop=document. DocumentElement. ScrollTop;
Window. The sessionStorage. SetItem (" scrollTop, "scrollTop);

{} else if (the document body)
ScrollTop=document. The body. The scrollTop;
Window. The sessionStorage. SetItem (" scrollTop, "scrollTop);

}
Return the scrollTop;
}
Distance can't use this way to obtain the scroll bar at the top of the height, the bosses have encountered this problem?

CodePudding user response:

The
refer to the original poster qq_41758763 response:
function setScrollTop () {
Var scrollTop=0;
If (document. The documentElement & amp; & Document. The documentElement. ScrollTop) {
ScrollTop=document. DocumentElement. ScrollTop;
Window. The sessionStorage. SetItem (" scrollTop, "scrollTop);

{} else if (the document body)
ScrollTop=document. The body. The scrollTop;
Window. The sessionStorage. SetItem (" scrollTop, "scrollTop);

}
Return the scrollTop;
}
Distance can't use this way to obtain the scroll bar at the top of the height, the bosses have encountered this problem?
problems have been found, need not reply, thank you
  • Related