# Ionic 3 ion-list: how to know item's position to scrollto?

**URL:** <https://forum.ionicframework.com/t/ionic-3-ion-list-how-to-know-items-position-to-scrollto/131990>\
**Category:** ionic-v3\
**Created:** [June 2, 2018, 3:23pm UTC](https://forum.ionicframework.com/t/ionic-3-ion-list-how-to-know-items-position-to-scrollto/131990 "2018-06-02T15:23:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IAmos](https://avatars.discourse-cdn.com/v4/letter/i/a587f6/32.png) [@IAmos](https://forum.ionicframework.com/u/IAmos)\
**Post date:** [June 2, 2018, 3:23pm UTC](https://forum.ionicframework.com/t/ionic-3-ion-list-how-to-know-items-position-to-scrollto/131990/1 "2018-06-02T15:23:34Z")

</div>

Hi,

Inside ion-list I have this

`<ion-item [id]="item.itemId">`

Each item has a date and the list is sorted down, by this date. When the view is loaded, I want the list to scroll automatically so the next item (chronologically) after today, will be the first visible one.

I have this code

```auto
scrollToNextOne(element:string) {
    let yOffset = document.getElementById(element).offsetTop;
    this.content.scrollTo(0, yOffset, 2000);
  }

```

But I don’t know the element id to scroll to. How can I know which item is the one that I need?

Thanks

---

<div class="post-metadata">

**Author:** ![robinyo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/robinyo/32/115964_2.png) [@robinyo](https://forum.ionicframework.com/u/robinyo)\
**Post date:** [June 7, 2018, 3:43am UTC](https://forum.ionicframework.com/t/ionic-3-ion-list-how-to-know-items-position-to-scrollto/131990/2 "2018-06-07T03:43:32Z")

</div>

See: [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView)

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:33pm UTC](https://forum.ionicframework.com/t/ionic-3-ion-list-how-to-know-items-position-to-scrollto/131990/3 "2021-07-19T21:33:41Z")

</div>

Closed on July 19, 2021, 9:33pm UTC


