Xgraf
4/15/2017 - 9:42 AM

Smooth scroll to Block (jQuery).

Smooth scroll to Block (jQuery).

/* Smooth scroll to Block
====================================*/
// select the button and set the click event
$("#btn-go").on("click", function(e) {
  
    // turn off default properties
    e.preventDefault();
    
    // find out the distance to the top of the unit
    var plansOffset = $("#block").offset().top;

    // create a scrolling animation
    $("html, body").animate({
        scrollTop: plansOffset
    }, 500);

});