Is there a way to programmatically scroll to a specific element in an ion-list? IonList doesn’t seem to have the same scroll functions that IonContent has.
You should be able to get the ion-item
you want to scroll to and use the standard scrollIntoView()
method on the element.
We use this on a standard li
. On component load, we set a class on the li
we want to scroll to. Then when the user wants to scroll there, we look up the element by class name and call scrollIntoView()
.
That worked perfectly. I did have to put the element look up in a setTimeout() to give the ion-items time to be placed into the DOM. Thanks!
1 Like