JSFiddle - React, Tailwind, and code Playground

by agconti

HTML

<button class="my-btn-class other-class"></button>

CSS

.my-btn-class {
     /* no stylings just a target*/
 }
 .other-class {
     width: 100px;
     height: 100px;
     background: black;
 }

JavaScript

function myAnimation(btn) {
     //do stuff to btn
     $(btn).animate({
         opacity: 0.25,
         left: "+=50",
         height: "toggle"
     }, 5000, function () {
         // Animation complete.
     });
 }
     $(function () {
         $(document).on("click", ".my-btn-class", function (e) {
             e.preventDefault();
             myAnimation(this);
         });
     });