JSFiddle - React, Tailwind, and code Playground

by Trifan Alexandru

HTML

<div class="action-menu">
  <div class="trigger circle">
  </div>
  <div class="action first circle invisible">
  </div>
  <div class="action second circle invisible">
  </div>
  <div class="action third circle invisible">
  </div>
</div>

CSS

.circle {
   border-radius: 40px;
    -moz-border-radius: 40px;
    -webkit-border-radius: 40px;
    -ms-border-radius: 40px;
}
.trigger {
  z-index: 100;
  width: 40px;
  cursor: pointer;
  height: 40px;
  background-color: red;
  position: absolute;
  bottom: 0px; 
  right: 0px;
}

.action-menu {
  position: relative;
  height: 100px;
  width: 100px;
}

.action {
  cursor: pointer;
  z-index: 1;
  transition: all .5s;
  background-color: blue;
  width: 20px;
  height: 20px;
  position: absolute;
}

.first {
  bottom: 60px;
  right: 10px;
}

.second {
  right: 50px;
  bottom: 50px
}

.third {
  right: 60px;
  bottom: 10px
}

.action.invisible {
  bottom: 0px !important;
  right: 10px !important;
  left: auto;
  top: auto;
}

JavaScript

$('.trigger').on('click', function() {
	if(!$(this).hasClass('active')) {
  		$('.action').removeClass('invisible');
      $(this).addClass('active');
  } else {
  	$(this).removeClass('active');
    $('.action').addClass('invisible');
  }
	
})