petersvegrup
8/2/2018 - 6:41 AM

Smooth scroll to - with offset

<a class="button--primary js-scrollto--tests" href="javascript:void(0)" title="Se våra blodprov">
    <span>Se våra blodprov</span>
</a>
 
<script>
    jQuery(".js-scrollto--tests").click(function() {
        jQuery('html, body').animate({
            scrollTop: jQuery("#lp-section--tests").offset().top -50
        }, 400);
    });
</script>