Gyancode

A free library of HTML, CSS, JS

Search This Blog

Monday 14 May 2018

OnClick Scrolling go to difine div

JS

$(() => { 
    //Smooth Scrolling Using Navigation Menu
    $('a.how-order').on('click', function (e) {
        $('html,body').animate({
            scrollTop: $($(this).attr('href')).offset().top - 61
        }, 1000);
        e.preventDefault();
    });  
});


HTML
<a href='#service-pro-main' class='how-order'>How to Order</a>


<div id="service-pro-main" class="pro_serv"></div>