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:)

New Topic/Question
Reply


MultiQuote




|