Skip to content

Make 2 elements scroll together #460

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

You must be logged in to vote

Assuming the two elements have exactly the same layout, you can try:

one.addListener(({ offset }) => {
  two.setPosition(offset.x, offset.y);
});

// add this if necessary
two.addListener(({ offset }) => {
  one.setPosition(offset.x, offset.y);
});

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@ThatOneCalculator
Comment options

@idiotWu
Comment options

@ThatOneCalculator
Comment options

@idiotWu
Comment options

@ThatOneCalculator
Comment options

Answer selected by ThatOneCalculator
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