JSFiddle - React, Tailwind, and code Playground
HTML
<DIV ID="Wrapper">
my content
</DIV>
CSS
#Wrapper {
float: left;
width: 700px;
height: 1400px;
background-color: red;
}
JavaScript
$(document).ready(function() {
$("#Wrapper").click(function () {
var th = $(this);
if (!th.hasClass('down')) {
console.log("ret");
th.addClass('down').stop(true).animate({
"top": "50px"
}, 1000, function() {
$('body').scrollTop(th.height());
});
} else {
console.log("sdffsdsff");
th.removeClass('down').stop(true).animate({
"top": "-400px"
}, 1000, function() {
$('body').scrollTop(th.scrollTop());
});
}
});
});