$('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;
    });
     
    });