JSFiddle - React, Tailwind, and code Playground
HTML
<div class="bouncer"></div>
<div class="results"></div>
CSS
.bouncer {
position: absolute;
width: 50px;
height: 50px;
background-color: red;
}
.results {
float: right;
}
JavaScript
function loop() {
$('.bouncer').animate({'top': '500'}, {
duration: 1000,
complete: function() {
$('.bouncer').animate({top: 0}, {
duration: 1000,
complete: loop});
}});
$('<div/>').text('exiting loop').appendTo($('.results'));
}
loop();