JSFiddle - React, Tailwind, and code Playground

by Dmitriy Shvanyk

HTML

<a href="#form" id="btn">btn</a>

<div class="div"></div>

<div id="form">form</div>

<div class="div"></div>

CSS

#form {
  display: none;
  background: #000;
  color: #fff;
  padding: 15px;
}

.div{
  height: 1000px;  
}

JavaScript

$(document).ready(function() {
  $('#btn').bind("click", function(e) {
    var anchor = $(this);
    
    e.preventDefault();
    $('#form').slideDown();
    $('html, body').stop().animate({
      scrollTop: $(anchor.attr('href')).offset().top
    }, 500);
  });
});