Scroll to Element jQuery

A useful function to scroll to element without a javascript or jquery plugin.

This is a small function to scroll to a desired element. This was written Cory LaViska and in my opinion a very good function to use for your future projects. This is short and small and you do not need a plugin.

$('a[href^="#"]').on('click', function(event) {
    var target = $(this.getAttribute('href'));
    if( target.length ) {
        $('html, body').stop().animate({
            scrollTop: target.offset().top
        }, 1000);