JSFiddle - React, Tailwind, and code Playground

by Steven Tang

HTML

<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<table>
  <tr>
    <td>
      <div id="1"></div>
    </td>
    <td>
      <div id="2"></div>
    </td>
    <td>
      <div id="3"></div>
    </td>
    <td>
      <div id="4"></div>
    </td>
  </tr>
  <table>

CSS

div {
  background-color: white;
  height: 150px;
  width: 100px;
  display: block;
}

;

JavaScript

var getBlackTile = function() {
  var blackTile = Math.floor(math.round(Math.random))
  switch (blackTile) {
    case 1:
      $('#1').animate({
        opacity: 0.3,
        color: 'red'
      }, "slow", function() {
        $(this).attr('data-marked', 'yes');
      });
      break;
    case 2:
      $('#2').fadeTo('black', 'fast');
      break;
    case 3:
      $('#3').fadeTo('black', 'fast');
      break;
    case 4:
      $('#4').fadeTo('black', 'fast');
      break;
  };
};
getBlackTile();