JSFiddle - React, Tailwind, and code Playground

by jasonwilczak

HTML

<div id='alert'>
    <span>this is my alert</span>
    <button class='alert'>Close</button>
</div>

CSS

#alert {
      position: fixed;
  left: 90%;
  top: 60%;
  transform: translate(-50%,-50%);
  background-color: rgba(255,0,0,0.3);
  width: 200px;
  height: 100px;
  border-radius: 10px;
  color: rgba(0,0,0,0.6);
    
}

JavaScript

function alertClose(){
    alert("hi");
    $("#alert").animate({
        left: "107%"
    });
}
$("#alert button").click(alertClose);