JSFiddle - React, Tailwind, and code Playground

by thanhansoft

HTML

<a href="#neo1">Neo 1</a>
<a href="#about">About us</a>
<a href="#neo3">Neo 3</a>
<br/>
<br/>

<div id="neo1" style="background:red; height: 300px">Neo 1111111</div>
<div id="about" style="background:green; height: 300px">Neo 1111111</div>
<div id="neo3" style="background:blue; height: 300px">Neo 33333333333333</div>

JavaScript

$("a[href*='#']:not([href='#])").click(function() {
    let target = $(this).attr("href");
    $('html,body').stop().animate({
      scrollTop: $(target).offset().top
    }, 1000);
    event.preventDefault();
  });