CSS translate example

With transition to smooth it out

HTML

<ul class="benefits">
<li>Free premium shipping</li>
<li>Free returns</li>
<li>Premium customer service</li>
</ul>

CSS

.benefits {
  color: white;
  background-color: black;
  text-align: center;
}
.benefits li {
  display: inline;
  margin-right: 20px;
  transition: all 3s;
}
.benefits li:last-child {
  margin-right: 0;
}

.begin {
  
}

.element {
  transform: translate(40px, 80px);
  transition: all 3s;
  border: red solid 1px;
  width: 100px;
  height: 100px;
  position: fixed;
  top: 0;
  left: 0;
}

body {
  height: 3000px;
}

.move {
  transform: translate(400px, 280px);
}

JavaScript

function tick() {
  var t = 200 * Math.random();
  var l = 200 * Math.random();
  console.log("tick: " + t)
  $('.element').css({
    'top': t + 'px',
    'left': l + 'px'
  });

}

setInterval(tick, 3000);

$('#but1').on('click', function() {
  $('.element').css({
    'top': '100px',
    'left': '100px'
  });

});
$('#but2').on('click', function() {
  $('.element').css({
    'transition': 'all 0s'
  });
});
$('#but3').on('click', function() {
  $('.element').css({
    'transition': 'all 3s'
  });
});