JSFiddle - React, Tailwind, and code Playground

by Intesar Haider

HTML

<a alt="#goto" class="sliding-link" style="height:1000px;display: inline-block;">Link to div</a>

<div id="goto">I'm the div</div>

JavaScript

$(".sliding-link").click(function(e) {
    e.preventDefault();
    var aid = $(this).attr("alt");
    $('html,body').animate({scrollTop: $(aid).offset().top},'slow');
});