JSFiddle - React, Tailwind, and code Playground
HTML
<div class="red">Here is my text.</div>
CSS
.red {
font-size:50px;
color:#c61a1a;
cursor:pointer;
}
JavaScript
var red = $(".red");
$.fn.glowEffect = function(start, end, duration, callback) {
if (this.data("last-glow"))
start = this.data("last-glow");
return this.animate({
'placeholder': end
}, {
duration:duration,
step: function(now, fx) {
now = parseInt(start + (end - start)*(fx.pos));
$(fx.elem).css("text-shadow","0px 0px "+now+"px #c61a1a")
.data("last-glow", now);
},
complete:callback
});
};
red.click(function() {
red
.stop()
.glowEffect(0,50,1000,
function()
{
$(this).glowEffect(50,0,1000);
});
});