Make 2 elements scroll together #460
Answered
by
idiotWu
ThatOneCalculator
asked this question in
Q&A
-
I have 2 html elements that I want to scroll together whenever the scroll wheel is touched, is there any way to link them up? |
Beta Was this translation helpful? Give feedback.
Answered by
idiotWu
Mar 15, 2022
Replies: 1 comment 7 replies
-
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);
}); |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
ThatOneCalculator
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Assuming the two elements have exactly the same layout, you can try: