JSFiddle - React, Tailwind, and code Playground

by Michel Plungjan

HTML

<div id="first">First</div>
<div id="second">Second</div>

JavaScript

$(function() {
  $("#second").css({
    opacity: 0.0
  });
  setInterval(rotateImages, 4000);    
});
function rotateImages() {
    if ($("#first").css("opacity") == 1) {
        $("#first").animate({
            opacity: 0.0
        }, 1500);
        $("#second").animate({
            opacity: 1.0
        }, 1500);
    } else {
        $("#second").animate({
            opacity: 0.0
        }, 1500);
        $("#first").animate({
            opacity: 1.0
        }, 1500);
    };

};