How to use inverted function in this case of jquery?

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 remove the blank class. How can I do it?

    
asked by anonymous 20.07.2015 / 14:51

1 answer

1

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

Use event mouseleave

It performs 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 at JSFIDDLE

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

See about it here at Difference between Mouseleave and Mouseout

    
20.07.2015 / 14:54