Since CSS is not my strong suit, I'm attempting to create a pressed button effect using the :active pseudo-class by applying a "glow" class to a DIV element with jQuery's addClass method and then removing it after a brief delay.
This is how I have written the code:
$( ".cpUpbtnsclass" ).on('click', function() {
console.log($( this ).attr('id')+" is clicked and a class will be added ! ");
$( this ).addClass( "glow");
setTimeout(function(){
$( this ).removeClass( "glow");
},300);
});
And here is the CSS class that I am trying to add:
.glow {
box-shadow: 0px 0px 15px 5px rgba(255, 255, 190, .75);
}
I can see the glow effect being added with addClass, but it doesn't seem to disappear after 300ms as intended.