JSFiddle - React, Tailwind, and code Playground

by sm1215

HTML

<div id="start-stop">
Start / Stop
</div>

JavaScript

$(document).ready(function() {
    $("#start-stop").fadeOut(3000);
    RndText();
    inter = setInterval(function() {

        RndText();
      }, 5000);
 });

$("body").mousemove(function() {
    $("#start-stop").finish().show().fadeOut(1500);
});

$(document).on('click', '#start-stop', function(){
  if (intervalRunning) {
    intervalRunning = false;
    clearInterval(inter);
    $(this).css('background-image', 'url(play.gif)').fadeOut(1500);
  } else {
    intervalRunning = true;
    $(this).css('background-image', 'url(pause.gif)').fadeOut(1500);
    inter = setInterval(function() {
      RndText();
    }, 3000);
  }
})