JSFiddle - React, Tailwind, and code Playground

by Augustus Yuan

HTML

<div class="outer-circle">
   <div class="circle"></div>
</div>

CSS

body {
    padding: 20px;
}

.circle {
    position: absolute;
    width: 0px;
    height: 0px;
    top: 50%;
    left: 50%;
    -webkit-transition-duration: 1s;
    -webkit-transition-property: top, left, padding, width, height;
    -webkit-transition-timing-function: ease-in-out;
    text-align: center;
    color: white;
    border-radius: 100%;
    background: red;
    padding: 0px;
    overflow: hidden;
    z-index: 2;
    font-family: sans-serif;  /* Just 'cos */
}

.open {
    top: 0px;
    left: 0px;
    width: 100px;
    height: 100px;
}

.outer-circle {
    position: relative;
    top: 50px;
    left: 50px;
    width: 100px;
    height: 100px;
    border-radius: 100%;
    border: 1px solid black;
}

JavaScript

$(document).ready(function() {
    
    $('.outer-circle').on('hover', function(e) {
        console.log('hello');
       $('.circle').toggleClass('open'); 
    });
    
    $('.outer-circle').on('touchstart', function(e) {
        console.log('hello');
       $('.circle').toggleClass('open'); 
    });
});