Detect when Scrollbar is not at the bottom of the page

0

I'm creating a Chat without refresh that displays your results in reverse order leaving the current ones on the bottom and the old on the top.

I already have the effect of moving the page to the end when a new comment is posted, but I need it to do so when the user is moving the ScrollBar up.

My idea was to calculate the difference of the height of the div and the position of the ScrollTop, however the properties below do not take the total size of the div.

Used js properties:

  element.height()
  element.innerHeight()
  element.outerHeight()

Just to note, my div has a 100% height and an auto overflow, I put an overflow hide on the body too, I've already switched these properties but I still did not get the actual value of the div.

Can anyone suggest an alternative to this case? Thank you all for your attention.

    
asked by anonymous 08.09.2018 / 03:19

0 answers