JSFiddle - React, Tailwind, and code Playground

by harshavarma

HTML

<div id="hotspot"></div>

CSS

#hotspot {
    width: 200px;
    height: 150px;
    background: #7cf4ba;
}

JavaScript

var Sandbox = {};
Sandbox.animateHotspot = function (hotspot) {
    setInterval(function () {
        $(hotspot).animate({
            opacity:1
        }, 3000, function () {                         // 3000 is the duration of animation.
            $(hotspot).animate({
                opacity:0
            }, 3000)
        })
    }, 8000);                                          // 8000 is the duration between the animation
}

Sandbox.animateHotspot('#hotspot');