var alt_top=top=0; var left; // высота блока с меню, px var h_nav =$('#menu_left').height(); //высота экрана var windows_height=$(window).height(); //высота контента var h_content=$("main").outerHeight(); $(window).scroll(function() { alt_top=top; top = $(this).scrollTop(); console.log(alt_top+":"+top); if (h_nav>windows_height) { if (top+windows_height >= h_nav && alt_top<=top) { if (h_nav<h_content) $("#menu_left").addClass("fixed"); } else { //идем наверх if ($("#menu_left").hasClass("fixed")) $("#menu_left").removeClass("fixed"); } }else{ //+ $("#menu_left").addClass("fixed").css("top","0px"); } }); 
An example of the VKontakte group https://vk.com/public79858706 what to do to reverse smooth scrolling up ...

  • I did not understand the question what kind of scroll? - Excess Gophers
  • We do a scroll, and before rendering we insert a slowdown or something like that. - Roman C
  • @ Exaggerated, an example of scrolling the right menu, like VKontakte, but in the opposite direction .... Example of VKontakte group vk.com/public79858706 - Flambo
  • @ RomanC, you don’t need to draw a scroll, you need to do something like the right VKontakte menu when it scrolls (it works fine downwards, only the reverse is not very smooth ....) - Flambo

0