I used jquery.sticky and jquery.scrollbar I tried scroll sticky block in parallel scroll window. This code is worked, but have some bags in chrome and Edge on windows. (there isn't on ubuntu). When sticky block is scrolling event scroll of window is triggered once. It seems that the scrolling is slow. When the sticky block is in the end position event scroll of window is triggered several. If I comment out lines "$('.content__sidebar').scrollTop(total_scrolled);" the slow scrolling will disappear. Sticky block have some child with jqury.scrollbar. I tried disable jquery.scrollbar but problem remained. Why event scroll of window is triggered once, when sticky block is scrolling?
$('.content__sidebar').sticky({topSpacing:155, bottomSpacing: 310});
$(window).scroll(function(e){
var scrollTop = $(window).scrollTop();//+10;
direction = scrollTop-scrollTop_prev;
console.log({scrollTop:scrollTop,scrollTop_prev:scrollTop_prev,direction:direction,total_scrolled:total_scrolled});
if (direction_prev>0 && direction<0) {
//console.log("revert");
//total_scrolled = $('.content__sidebar').scrollTop();
} else if (direction>0) {
//console.log("down");
total_scrolled += direction;
$('.content__sidebar').scrollTop(total_scrolled);
} else {
total_scrolled += direction;
$('.content__sidebar').scrollTop(total_scrolled);
}
if (total_scrolled>$('.content__sidebar').scrollTop()) {
total_scrolled = $('.content__sidebar').scrollTop();
}
if (total_scrolled<0) {
total_scrolled = 0;
}
scrollTop_prev = scrollTop;
direction_prev = direction;
});