How to use reversed function in this case of jquery?

Asked

Viewed 29 times

1

// Aplicando CSS na Página de Eventos
$(".descr-eventos").on('mouseover', function(){
    $(this).find('.link-evento').addClass('blank'); 
}, function(){
    $(this).find('.link-evento').removeClass('blank');  
});

I want when I remove the mouse to be removed the class blank. How can I do?

1 answer

1

From what I understand, you want to use what would be the inverse of mouseenter (executes an event when the mouse is placed on an element).

Use the event mouseleave

It executes an action when the mouse leaves a certain element.

Example:

$(".descr-eventos").on('mouseover', function(){
    $(this).find('.link-evento').addClass('blank'); 
}).on('mouseleave', function(){
    $(this).find('.link-evento').removeClass('blank');  
});

See working on JSFIDDLE

There is also the mouseout, which does the same thing, but with some variations

See about this here at Difference between Mouseleave and Mouseout

Browser other questions tagged

You are not signed in. Login or sign up in order to post.