Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Stop Fixed Scrolling When 250px from the Bottom of the Page

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #144630
    realph
    Participant

    James over on Stack Overflow came up with a pretty elegant solution for this. With a div starting 250px from the top and sticking to the top when scrolled. I’m looking for a similar solution, wherein I need my div to start at the bottom of the page with bottom: 0; and end up bottom: 250px by the time you hit the footer.

    Here’s [James’ solution](http://stackoverflow.com/questions/5902822/stopping-fixed-position-scrolling-at-a-certain-point “”):

    $(window).scroll(function(){
    $(“#theFixed”).css(“top”,Math.max(0,250-$(this).scrollTop()));
    });
    I sort of need to reverse this, I’ve tried .scrollBottom to no avail. Any ideas what I’m doing wrong?

    Any help is appreciated. Thanks in advance!

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.