MurhafSousli / ngx-scrollbar

Custom overlay-scrollbars with native scrolling mechanism
https://ngx-scrollbar.netlify.app/
MIT License
618 stars 99 forks source link

Alignment options for SmoothScrollToOptions #637

Closed Smarthard closed 1 month ago

Smarthard commented 3 months ago

Feature Description

I think it would be great if ngx-scrollbar could provide out-of-the-box solution for alignment of element user want to scroll into.

Use Case

ngxScrollbar.scrollToElement('#target', { align: 'middle' })
// also maybe: right, left, top, bottom
// probably combination of the above

In this case scrollbar will scroll to the middle of available scrollable container near the target element.

MurhafSousli commented 1 month ago

@Smarthard in v16, you can use all the options that scrollTo function has. and added a boolean option center to scroll to the center of a target element.