JSFiddle - React, Tailwind, and code Playground
HTML
<div id="square">
asd
</div>
CSS
#square {
width: 25px; height: 25px;
padding: 25px;
background: red;
color: #fff;
position: absolute;
top: 50px; left: 100px;
}
JavaScript
var $square = $("#square");
bounce();
function bounce() {
$square.animate({
top: "+=10"
}, 300, function() {
$square.animate({
top: "-=10"
}, 300, function() {
bounce();
})
});
}
$square.hover(function() {
jQuery.fx.off = true;
}, function() {
jQuery.fx.off = false;
});