JSFiddle - React, Tailwind, and code Playground

by luka kupunia

JavaScript

function scrollToAnchor(aid){
  var aTag = $(aid);
  $('html,body').animate({scrollTop: aTag.offset().top},1000);
}

$("a").on('click', function(event) {
	event.preventDefault();
	var hash = this.hash;
  if ($(hash).offset() != undefined) {
	var y = $(hash).offset().top;
  }
	$('html, body').animate({
        scrollTop: y
        }, 800, function(){
	});
});