I've got a simple addClass function to add a class on hover so that I can apply a CSS transition to it. I also want the CSS transition to apply when the mouse leaves the container but It doesn't work because I have .removeClass. I realize I can do it with CSS but I'm trying to learn JS.
I've tried the setTimeout like so:
$('.wp-container-20').hover(
function() {
$(this).addClass('homeServicesImageHover').bind(this)
},
function() {
setTimeout(
function() {
$(this).removeClass('homeServicesImageHover')
}, 5000)
}
)
I can't get that to work.