Skip to content

how to get offset on scrolling? #377

Answered by idiotWu
harrybest asked this question in Q&A
Discussion options

You must be logged in to vote

scrollbar.offset is an instance property, so you need to

const scrollbar = Scrollbar.get(elem /* the element on which the scrollbar is initialized */);
console.log(scrollbar.offset);

You can also use the addListener() method to get offset on scrolling:

scrollbar.addListener(({ offset }) => {
  console.log(offset);
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@harrybest
Comment options

Answer selected by idiotWu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants