<div class="wrapper">
  <p class="text is-float">animation</p>
</div>
.text{
  width: 200px;
  padding: 10px 0;
  margin: 40px auto 0;
  background: #ff0000;
  border-radius: 10px;
  text-align: center;
  color: #fff;
  font-size: 24px;
  font-weight: bold;
}
$(function(){
  setTimeout('animation()');
});

function animation(){
  const $animation =  $('.is-float');
  $animation.animate({
    marginTop: '20px'
  }, 1000).animate({
    marginTop: '60px'
  }, 1000);
   setTimeout('animation()', 1000);
};

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js