var a = $(".sticks"); if (a.length > 0) var b = a.height(), c = a.offset().top - 90; $(window).scroll(function() { if (a.length > 0) { var d = $(window).scrollTop(); if (c < d) { a.css("top", d - c); var e = a.offset().top + b, f = $("main").offset().top + $("main").height(); if (f < e) { var g = $("main").height() - b; a.css("top", g) } } else a.css("top", "0") } }), $(window).resize(function() { a.length > 0 && (b = a.height()) }) 

Greetings, I need help, there is a code that works, but when I scroll to the end of the main block, it disappears, I need this block to stop and not go further and not disappear.

  • Lord, are you writing the obfuscated code right away? - Alexey Shimansky
  • No, this code has been compressed by js compressor. - Makissm
  • The block disappeared due to c = a.offset (). Top - 90; moved here a.css ("top", d - c - 90); the block has ceased to disappear, but now it scrolls behind the footer, like this part if (f <e) {var g = $ ("main"). height () - b; a.css ("top", g)} rewrite it to stop at the end of the block? - Makissm

0