G
G
Genri_Rus2020-04-30 19:28:15
JavaScript
Genri_Rus, 2020-04-30 19:28:15

How to know end of scroll when scrolling?

How, depending on the height / resize, to find out that a person has scrolled to the end?
I have a small example: https://codepen.io/Genri_Rus/pen/VwvMZMx

The panel is pressed to the bottom and, accordingly, the height of the body is different, but how exactly do you know the end of the scroll?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-04-30
@Genri_Rus

window.addEventListener('scroll', event => {
  if (scrollY + innerHeight === document.body.scrollHeight) {
    // Code here
  }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question