How to know if "ion-content" is at the top (no scroll)?

Hello,

I am looking for a method to know if “ion-content” is at the top.

Some use cases:

  • By default when page load “ion-content-IsAtTop” = true
  • If you scroll down “ion-content-IsAtTop” = false but if it comes back at the top “ion-content-IsAtTop” = true

I might add an event listener on the scroll, but how to know when I get back on top. And event listener on scroll is not the best for performance.

If someone has a good method, I am interested.

Nevermind

this.content.getScrollTop() solves my problem.

1 Like