ian
2/21/2018 - 6:40 PM

Scroll to top

Show "back_to_top" when page is scrolled. Go back to "this_is_top" when clicked.

$(document).ready(function() {
    var offset_h = 250, duration = 450;
    $(window).scroll(function() {
        $('#back_to_top').delay(1500).css( "display", "inline" ).fadeOut(1400);
    });
    $('#back_to_top').click(function(event) {
        event.preventDefault();
        $('html, body').animate({
            scrollTop: $('#this_is_top').offset().top - 220
        }, duration);
        return false;
    });
    $('#jump_to_section_3').click(function() {
        $('#thankyou_modal').modal('hide');
        $('html, body').animate({
            scrollTop: $('#third').offset().top - 120
        }, 2000);
    });
});