JSFiddle - React, Tailwind, and code Playground
HTML
<p class="">x</p>
CSS
body {
margin: 0;
padding: 0;
height: 100vh;
width: 100vw;
}
.move {
animation: MoveUpDown 1s linear infinite;
position: relative;
left: 0;
bottom: 0;
}
@keyframes MoveUpDown {
0%, 100% {
bottom: 0;
}
50% {
bottom: 15px;
}
}
JavaScript
$('body').on('mousedown', function() {
$('p').addClass('move');
$('body').on('mouseup', function() {
$('p').removeClass('move');
$('body').off('mouseup');
console.log('here');
})
});