Search code examples
javascriptscrollto

ScrollTo with animation


how can i add an easing/animation/slowly moving to this function? At the moment it just jumps. Now it should move to the "anchor" with an animation.

<script type='text/javascript'>
        setTimeout("window.scrollBy(0,270);",3000);
</script>

Solution

  • got it myself. because of wordpress and the jquery.noConflict Mode i hade to modify the code:

    <script type="text/javascript">
            (function($){
            $(document).ready(function(){
                setTimeout(function() {
                $('body').scrollTo( '300px', 2500 );
            }, 3000);
            });
            }(jQuery));
    </script>
    

    thanks for everybody!!!