Q: how to set speed following sidebar I am using a sidebar which automatically scrolls up and down when scrolling the site. I am using this script for it:
 $(function() {
        var offset = $("#sidebar").offset();
        var 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
                });
            };
        });
    });

But the automatically scrolling is a little bit fast. How can I set the speed of the up an  down scrolling of the sidebar?

A: Assuming you're using jQuery, you can set the speed of the animation using "duration". It's a bit tricky to know if it works without the full HTML, but try this:
$(function() {
    var offset = $("#sidebar").offset();
    var topPadding = 15;

    $(window).scroll(function() {

        if ($(window).scrollTop() > offset.top) {

            $("#sidebar").stop().animate({
                marginTop: $(window).scrollTop() - offset.top +  topPadding
            },{
                duration: 1000
            });
        } else {
            $("#sidebar").stop().animate({
                marginTop: 0
            },{
                duration: 5000
            });
        };
    });
});

Source:  http://api.jquery.com/animate/
