Forums

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

Home Forums JavaScript Help with Scroll/Follow Sidebar

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30791
    jsweazy
    Member

    I used the jquery technique to have a scrolling/following sidebar from this site, here is the code if you dont know what im talking about:

    $(function() {

    var $sidebar = $("#scroll-menu"),
    $window = $(window),
    offset = $sidebar.offset(),
    topPadding = 15;

    $window.scroll(function() {
    if ($window.scrollTop() > offset.top) {
    $sidebar.stop().animate({
    marginTop: $window.scrollTop() - offset.top + topPadding
    });
    } else {
    $sidebar.stop().animate({
    marginTop: 0
    });
    }
    });

    });

    also here is the link https://css-tricks.com/scrollfollow-sidebar/

    The only problem that i have with this is that it has an container but when you scroll far enough into footer the sidebar scrolls out of container. Is there a way i can constrain how far it scrolls down?

    Thanks in advance

    #65530
    jsweazy
    Member

    Can anyone help?

    if needed here is an image

    http://tinypic.com/r/2mcj2mv/7

    #65502
    clokey2k
    Participant
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.