1 Replies - 967 Views - Last Post: 14 September 2012 - 05:16 AM

#1 Joepiooo1988  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 07-June 12

Scrolling sidebar wont stop scrolling at footer

Posted 14 September 2012 - 01:08 AM

Hello,

I have a sidebar that scrolls down along the user scrolling...

That is working perfectly but it keeps scrolling down and down and down and wont stop..

This is the script:

    $(function() {  
        var offset = $(".centerright").offset(); //Sets which element is scrollable. In this case it's the div .sidebar  
        var topPadding = 0;  //Set how much top-padding the element has.  
        $(window).scroll(function() {  
            if ($(window).scrollTop() > offset.top) {  
                $(".centerright").stop().animate({   //Sets which element is scrollable. In this case it's the div .sidebar  
                    marginTop: $(window).scrollTop() - offset.top + topPadding  
                });  
            } else {  
                $(".centerright").stop().animate({   //Sets which element is scrollable. In this case it's the div .sidebar  
                    marginTop: 0
                });  
            };  
        });  
    });  


How can I let this sidebar stop at my footer or bottom of page?

Any help would be welcome:)

Is This A Good Question/Topic? 0
  • +

Replies To: Scrolling sidebar wont stop scrolling at footer

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3718
  • View blog
  • Posts: 5,989
  • Joined: 08-June 10

Re: Scrolling sidebar wont stop scrolling at footer

Posted 14 September 2012 - 05:16 AM

This seems to work fine over here. In my test page, the .centerright element animates into place when I scroll as expected. It doesn't continuously scrolling anywhere.

Could you show us the entire page that is generating this, or better yet, a link to a live demonstration? Perhaps we can spot the problem there.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1