Akryum / vue-virtual-scroller

⚡️ Blazing fast scrolling for any amount of data
https://vue-virtual-scroller-demo.netlify.app
9.48k stars 901 forks source link

Scroll to item and have it at the bottom #623

Closed usernamehw closed 3 years ago

usernamehw commented 3 years ago

Executing .scrollToItem(index); always sets active element at the top of the list.

.scrollToItem(index);

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

Is it possible to scroll and have active index at the bottom?

usernamehw commented 3 years ago

Possible with .scrollToPosition()

Something like:

if (scrollingDown) {
    this.$refs.itemsContainer.scrollToPosition((index - this.settings.maxListItems + 1) * ITEM_HEIGHT);
} else {
    this.$refs.itemsContainer.scrollToItem(index);
}