$.fn.glow = function(delay = 1000) {
return this.each(function() {
let interval;
const startGlow = () => {
interval = setInterval(() => $(this).toggleClass('glow'), delay);
}
const stopGlow = () => {
clearInterval(interval);
}
$(this).on('mouseenter', stopGlow);
$(this).on('mouseleave', startGlow);
startGlow();
return this;
})
}
$('.glowable').glow();