Ionic horizontal scroll to anchoring certain element




my code is as above.
I think i get yOffset quite well.
but the problem is how to anchor to specific yOffSet

I have a div like below to scroll it and refer to viewchild content( is this a right way?)

but it never anchor to yOffset.


scrollTo takes x,y and duration
What are you doing is trying to scroll vertically and not horizontally.
It should be like

this.content.scrollTo(left, 0, 4000);
1 Like

I tried…but not working…
is it right to use viewchild content like as I did? #content

Ah yes sorry my bad i thought you applied this to ion-content. scrollTo works for ion-content.
You can use element.scrollLeft property to do what you want more info:

1 Like