views:

18

answers:

0

hi,

i have this code:

<script type="text/javascript">
    $(document).ready(function() {
        var offset = $("#sidebar").offset();
        var sidebar_height = 0;
        var stopper = $("#stopper").offset();
        var topPadding = 1;
        $(window).scroll(function() {
            if (sidebar_height==0) sidebar_height = $("#sidebar").height();
            if($("#sidebar").offset().top+sidebar_height<stopper.top-200) {
                if ($(window).scrollTop() > offset.top) {
                    $("#sidebar").stop().animate({
                        marginTop: $(window).scrollTop() - offset.top + topPadding
                    });
                } else {
                    $("#sidebar").stop().animate({
                        marginTop: 0
                    });
                };
            } else {
                if ($(window).scrollTop()>offset.top&&$(window).scrollTop() < $("#sidebar").offset().top) {
                    $("#sidebar").stop().animate({
                        marginTop: $(window).scrollTop() - offset.top + topPadding
                    });
                }
            }
        });
    });
</script>

i have the Stopper at the bottom and i'm getting it's position when i scroll slowly it will stop but if i will hit "end" button or scroll real fast - it will expand my table td

what can i do with that?