Why will window.scrollY be less than document.documentElement.scrollHeight ??

  • 0
    Hello guys, please tell me why when I scroll to the end window.scrollY will be less than document.documentElement.scrollHeight, it's just strange that the height of the page is greater than the length of the scroll, for 2 days I have been trying to fight this problem. That is, if the length of the scroll is equal to the length of the page, then we exit the conditions. Thanks in advance))
    JavaScript Nolan Nolan, Aug 5, 2020

  • 1 Answers
  • 0
    Because window.scrollY and window.scrollX points to the position of the top-left corner of the screen. And it, when scrolling down to the end, will be equal to scrollHeight - clientHeight .

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!