<div>
<header>
лого
nav
див
</header>
<main>
<section></section>
</main>
</div>
const sidebarScroller = document.querySelector(".sidebar__scroller");
const state = {
pageYOffset: 0
}
window.addEventListener("scroll", function (e) {
const scrollMaxSideBar = sidebarScroller.scrollHeight - sidebarScroller.clientHeight;
const procent = 3;
const procentScrollSideBar = Math.round(procent * scrollMaxSideBar / 100);
const scrollTopSideBar = Math.round(sidebarScroller.scrollTop);
if(state.pageYOffset > window.pageYOffset){
sidebarScroller.scrollTop = scrollTopSideBar - procentScrollSideBar;
} else if(state.pageYOffset < window.pageYOffset){
sidebarScroller.scrollTop = scrollTopSideBar + procentScrollSideBar;
}
state.pageYOffset = window.pageYOffset;
});