1

I currently have a div that is scrollable (both x and y), and in order to synchronize the scroll position with another div I need its scroll position. Unfortunately .position() and .offset() don't help me. Is there another JS/JQuery approach I could use?

kd1978
  • 487
  • 5
  • 21

1 Answers1

1

Something like this should do the job:

$('#source').on('scroll', function () {
    $('#target').scrollTop($(this).scrollTop());
    $('#target').scrollLeft($(this).scrollLeft());
});
Martin Adámek
  • 16,771
  • 5
  • 45
  • 64