<pre class="lang:js decode:true  ">jQuery('a[data-scroll]').click(function (e) {
        var scrollTarget = jQuery(this).data('scroll');
        if ( $(scrollTarget).length ) {
            $('html, body').animate({
                scrollTop: $(scrollTarget).first().offset().top
            }, 'slow');
        }
        e.preventDefault();
    });</pre>
example:

&lt;a href="#target" data-scroll="#target"&gt;Link&lt;/a&gt;