JSFiddle - React, Tailwind, and code Playground

HTML

<div class="block"></div>

CSS

*{margin: 0; padding: 0;}

html, body {
    width: 100%;
    height: 100%;
}

.block {
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   width: 200px;
   height: 200px;
   margin: auto;
   position: absolute;
    
   background-color: red;
}

.offset {
    /* margin-left: 0; */
    -webkit-animation: offsetMenu 2s;
}

@-webkit-keyframes offsetMenu {
  to { margin-left: 0; }
}

JavaScript

$(".block").click(function () {

    $(this).toggleClass("offset");
});