January 29, 201214 yr Hi, Basically, I have put a sidebar which slides with the content of a web page following: http://css-tricks.com/scrollfollow-sidebar/ Worked good, but an issue I had was that as the sidebar is quite long (contains facebook like box) when it reached the bottom of the page it destroyed my footer layout...so I added this amended jquery: http://stackoverflow.com/questions/4716795/help-with-scroll-follow-sidebar It doesn't destroy my footer, but the sidebar basically comes down, say 600px, more than the left content (due to the length of the sidebar i quess) shown on the attachment... $(function() { var $sidebar = $("#scroll-menu"), $window = $(window), $footer = $("#footer"), // use your footer ID here offset = $sidebar.offset(), foffset = $footer.offset(), threshold = foffset.top - $sidebar.height(); // may need to tweak topPadding = 15; $window.scroll(function() { if ($window.scrollTop() > threshold) { $sidebar.stop().animate({ marginTop: threshold }); } else if ($window.scrollTop() > offset.top) { $sidebar.stop().animate({ marginTop: $window.scrollTop() - offset.top + topPadding }); } else { $sidebar.stop().animate({ marginTop: 0 }); } }); }); I'm assuming I need to add something here: threshold = foffset.top - $sidebar.height(); // may need to tweak Any help would be great!
Create an account or sign in to comment