There are two div-block # block1 and # block2 . When scrolling the first block by moving its scroll bar, the second block should scroll, i.e.
$('#block1').scroll(function() { var scrollTop = $(this).scrollTop(); $('#block2').scrollTop(scrollTop); }); At the same time, when scrolling the second block, but this time turning the mouse roller (mousewheel) over it, and not by moving its scroll bar, the first block should scroll. If I finish the second function
<script src="jquery.mousewheel.js"></script> ... $('#block2').mousewheel(function() { var scrollTop = $(this).scrollTop(); $('#block1').scrollTop(scrollTop); }); then when scrolling the second block of mice, in addition to the second one, the first function is also started and the scrolling is obtained incorrectly, as if “double” scrolling, one in the other.
How in the first function instead of scroll(function() to specify specifically "moving the scrollbar" so that there is no problem described above?