joeyfigaro
6/4/2013 - 3:14 PM

Smooth scrolling for internal links

Smooth scrolling for internal links

$('a[href^="#"]').bind('click.smoothscroll',function (e) {
    e.preventDefault();

    var anchor = this.hash,
        $target = $(target);

    $('html, body').stop().animate({
        'scrollTop': $target.offset().top
    }, 500, 'swing', function () {
        window.location.hash = anchor;
    });

});