How to disable scrolling more than the specified number of pixels?

Good evening. Please tell me how do I stop the user on the spot if he reached the line?

function populate(event) {

 while(true) {

 // the lower boundary of the document
 let windowRelativeBottom = document.documentElement.getBoundingClientRect().bottom

 // if the user has scrolled far enough (< 100px to the end)
 if (windowRelativeBottom < document.documentElement.clientHeight + 100) {

 windowRelativeBottom = windowRelativeBottom - 1

}

}

}

 window.addEventListener('scroll', function(e) {
populate()
 })
April 4th 20 at 00:42
1 answer
April 4th 20 at 00:44
Yes, it's only a script and do pokupateli

Find more questions by tags JavaScript