'duration' param of ScrollTo function of ion-content limits the length of scroll


#1

I want to scroll to a specific component in an ion-list using its position that I got using the id of the component, like follow :

//this.idRec is the ID of the component 
    let element = document.getElementById(this.idRec);
    let offset = element.offsetTop;

To scroll to that specific component I used the function scrollTo(x , y , duration) of ion-content.

    this.content.scrollTo(0, offset, 800);

Yet, this function isn’t working in all cases and I found its behavior weird.

  • When I set the duration param to 300, it can’t scroll to far items (for example those who are at the 10th position in the list)
  • But when I set the duration param to 800 or 1000, it can scroll to those far items ( those who are at the 10th position in the list) but it also has a limit when scrolling down and it can go further than a specific position.

Can anyone help me and explain to me what the ‘duration’ param does or how this function use it.
Can this param be dynamic ? how ?
Thanks in advance.