JSFiddle - React, Tailwind, and code Playground
HTML
<div id="content">click me</div>
<div id="other-content">click me</div>
<input type="hidden" value="skip0" />
CSS
#content,
#other-content {
background-color: red;
height: 500px;
left: 100px;
position: absolute;
text-align: center;
top: 200px;
width: 100px;
}
#other-content {
background-color: orange;
left: 300px;
}
input {
position: absolute;
top: 500px;
}
JavaScript
$("#content").click(function() {
var dest = $(this).offset().top;
console.log(dest, typeof(dest));
$("html, body").animate({ scrollTop: dest });
});
$("#other-content").click(function() {
var dest = $('input[value="skip0"]').offset().top;
console.log(dest, typeof(dest));
$("html, body").animate({ scrollTop: dest });
});