Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript to synchronise the scrolling of two list boxes?

How can we synchronise the scrolling of two list boxes so that scrolling of one list box results in scrolling of the other list box.

like image 946
user Avatar asked Nov 21 '25 14:11

user


1 Answers

Here you have some guidelines:

  • Use the scroll events on both listboxes $(".listbox").bind("scroll", ...)
  • Inside it, get the scrolled coordinate with scrollTop css
  • Use this value to change the other listbox's scrollTop

This way both will scroll together.

Hope this helps. Cheers

like image 102
Edgar Villegas Alvarado Avatar answered Nov 23 '25 04:11

Edgar Villegas Alvarado



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!