JSFiddle - React, Tailwind, and code Playground

by joshmoto

HTML

<script src="//code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="h-100 d-flex align-items-center">
  <div class="text-center">
    <button class="btn btn-primary btn-demo">
      Long demo button title for testing
    </button>
  </div>
</div>

SCSS

HTML,
BODY {
  height: 100%;
  min-height: 100%;
  cursor: crosshair;
  width: 100%;
}

BUTTON {
  cursor: crosshair !important;
}

JavaScript

$('.btn-demo').on('click', function(e) {

  $btn.css({
    position: "absolute",
    left: e.pageX-($btn.outerWidth()/2),
    top: e.pageY-($btn.outerHeight()/2)
  })

});