Perfect-scrollbar: Scroll to a specific element - enhancement

Created on 15 Apr 2016  路  2Comments  路  Source: mdbootstrap/perfect-scrollbar

Hi, in the project I am, we select an element from a list that can be in any place (bot, top, middle) and the app redirects to a section where all the elements are displayed with a detail section. I need to set the scroll to this element so it is seen at the top no matter where it is in the list.

My idea is to create an event that the perfect-scrollbar looks for this element, can be by a class (?) and sets the element to the top.

Most helpful comment

if you use angular you can check out ngx-perfect-scrollbar

They have this method
scrollToElement(qs, offset?, speed?) // Animate scroll to element matching query selectors.

All 2 comments

Hi there,

pefect-scrollbar aims to not change default scrolling behaviour. This means that the way you would achieve this with a native browser scrollbar is the same way you'd achieve it with perfect-scrollbar.

This means you don't need a custom function, but could it achieve it a similar way as shown in this JSFiddle. I hope that addresses your issue. Feel free to re-open if you need further help.

if you use angular you can check out ngx-perfect-scrollbar

They have this method
scrollToElement(qs, offset?, speed?) // Animate scroll to element matching query selectors.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Brugarolas picture Brugarolas  路  7Comments

yabikusensei picture yabikusensei  路  3Comments

zadremal picture zadremal  路  5Comments

kty picture kty  路  5Comments

eddieklc picture eddieklc  路  3Comments