How can I see my scrollPosition?

I want to indicate at which point of the submenu my user is. I have one page with some headings which stand for a subject and have an id. I can click on the links in my sidemenu and that opens the page if not already open and instantly goes to the selected topic/heading. To indicate the readers positions I would have to know what his scrollPosition is. I didn’t find a way to do it with the ion-content methods/properties. Is there some other way to do it, or am I just doing it wrong? Any help would be appreciated. Thanks!

This will be help you.

First import this.

import { Component, OnInit, HostListener, } from '@angular/core';

then this function helped you know the position

@HostListener('window:scroll', [])
  onWindowScroll() {
    const position= (document.documentElement.scrollTop + document.documentElement.clientHeight);
    const size = document.documentElement.scrollHeight;
    /*position will change every time you scroll, so you can know in which position you are*/