When a user scrolls past a div I need it\'s css changed to position:fixed. Much like what is done here: http://imakewebthings.com/jquery-waypoints/shortcuts/sticky-elements/
This is what finally worked for me:
jQuery(document).ready(function() {
var topOfrel = jQuery("#this").offset().top;
var topOffooter = jQuery("#footer").offset().top - jQuery(window).height();
var topOffootero = topOffooter ;
var boxheight = jQuery(window).height() - 130;//adjusting for position below
jQuery(window).scroll(function() {
var topOfWindow = jQuery(window).scrollTop();
if (topOfrel < topOfWindow && topOffooter > topOfWindow) {
jQuery("#this").css("position", "fixed").css("top", "130px").css("overflow","auto").css("height", boxheight + "px");
} else {
jQuery("#this").css("position", "static");
}
});
});