JSFiddle - React, Tailwind, and code Playground
by Shidhin C R
HTML
<script src="http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"></script>
<html>
<body>
<a id="scroll" href="#">scroll</span>
<div class="first"></div>
<div class="second"></div>
</body>
</html>
CSS
div {
width:200px
}
.first{
background-color:green;
height:1600px;
}
.second{
background-color:red;
height:1060px;
}
#scroll {
color:orange;
margin-bottom:20px;
display:block;
}
JavaScript
jQuery(function(){
$("#scroll").bind("click",function(e){
var newtop = $(".second").offset().top;
$('html,body')
.animate({scrollTop: newtop-2}, 1500);
return false;
});
});