Sidebar Sticky Issue
-
I am using the following jQuery code to make my sidebar sticky just like WordPress sticky plugin.
<script> function sticky_relocate() { var window_top = $(window).scrollTop(); var div_top = $('#sticky-anchor').offset().top; if (window_top > div_top) { $('#sticky').addClass('stick'); } else { $('#sticky').removeClass('stick'); } } $(function() { $(window).scroll(sticky_relocate); sticky_relocate(); }); </script> /****** CSS *******/ sticky.stick { position: fixed; top: 35px; z-index: 1; width: 306px; margin: 0 auto; margin-bottom: 0; margin-left: 27px; margin-right: auto; padding: 25px 40px; }
Issue: I want it to stop scrolling when it gets to footer or bottom of the sample ESA letter page, but it starts overlapping with footer.
I think I have to measure number of scrolls but don’t know how to implement it.
Any examples?
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Sidebar Sticky Issue’ is closed to new replies.