Skip to content Skip to sidebar Skip to footer

Scrolling Div Fixed Until Footer

Hi I'm hoping somebody can help me out i've been looking up a lot of tutorials to see if this could be done easily I'm new to jQuery, I'm trying to scroll a fixed div down the page

Solution 1:

Here's the jQuery which should help. Just make a css class that changes the box how you want it.

$(document).on('scroll', function(){
    var scroller = $('#scroller');
    var footer = $('#footer');
    var scroll_bot = scroller.offset().top + scroller.height();
    var footer_top = footer.offset().top;

    alert(scroll_bot);
    if(scroll_bot > footer_top){
        scroller.addClass('classThatMakesBoxActRight');
    }else{
        scroller.removeClass('classThatMakesBoxActRight');
    }
});

Post a Comment for "Scrolling Div Fixed Until Footer"