Is it possible to synchronize two mscrollbar (two-way)?

146 views Asked by At

i use the plugin jQuery custom content scroller.

I'm looking to synchronize two scrollbar (two-way).

Using the callback onWhileScrolling and scrollTo it works but the scrollTo fires at the end of the event . I would like the synchronization is real time (instantaneous).

I also use the mousewheel event on their parent container , it synchronizes the way I want. Only focus on one , I 'm out of sync.

An idea?

Structure:

<div class="parent_container">
<div class="scroll1"><!--div content --></div>
<div class="scroll2"><!--div content --></div>
</div>

thanks

1

There are 1 answers

0
CodeBehind On

I have done an quick example in JS Bin with jQuery for you. JS Bin

I'm using the scroll event of jQuery.(it's the best for your needs i think)

I also changed your classes and used id's instead (classes are for multiple use in my opinion).

With my Code you are able to have an dynamic number of synchronized scrolls.
Just add a new div with the id 'scroll3' and class 'syncScroll' to see how it works.

It's also working in "real time" as you wished.

I hope that is helping you.

used jQuery Version: 2.1.1