0

I have this code:

<a name="point1"> < /a>   //  at the very beginning   

<a href="link.php#point1"> Link1 < /a>     //    at the very end

when you click on Link1 the browser moves fast to the point1
Can I make the browser to move slowly?

mnel
  • 105,872
  • 25
  • 248
  • 242

1 Answers1

2

This is quite easy to do with jQuery by animating the scrollTop of the html and body:
http://css-tricks.com/snippets/jquery/smooth-scrolling/

Here's a snippet from a comment on that page:

$('a[href*=#]:not([href=#])').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        || location.hostname == this.hostname) {

        var target = $(this.hash);
        target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
           if (target.length) {
             $('html,body').animate({
                 scrollTop: target.offset().top
            }, 1000);
            return false;
        }
    }
});
fernozzle
  • 426
  • 2
  • 7