JSFiddle - React, Tailwind, and code Playground

by asif097

HTML

<div>
    <span class="link" rel="#products">Products</span>
     <span class="link" rel="#contactinfo">Contact info</span>

</div>

<div style="height:800px;"></div>
<div id="products">products</div>
<div style="height:800px;"></div>
<div id="contactinfo">contact</div>
<div style="height:800px;"></div>

CSS

span.link {
    text-decoration: underline;
    color: blue;
    cursor:pointer;
}

JavaScript

$(document).ready(function(){
   $('.link').on('click',function (e) {
       $('html, body').stop().animate({
            'scrollTop': $($(this).attr('rel')).offset().top
        }, 900, 'swing', function () {});
   });
});