Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid html table flickering on mouse hover

I need to avoid html table flickering on mouse hover. when someone hover a row it shows a button, but the table seems a litlle bit weird.

Here is my code http://jsfiddle.net/7nqLg/2/

like image 355
Otto Avatar asked Oct 09 '22 18:10

Otto


1 Answers

Use mouseenter and mouseleave instead.

jQuery('.myRow').mouseenter(function() {
    jQuery(this).find('div:first').css('visibility', 'visible');
}).mouseleave(function() {
    jQuery(this).find('div:first').css('visibility', 'hidden');
});

And instead of hiding the element set its visibility to hidden and on mouse over make it visible, this will avoid the flickering because the div occupies some space when you show it. Making its visibility hidden will still occupy the space but won't be displayed.

Demo

like image 126
ShankarSangoli Avatar answered Oct 11 '22 23:10

ShankarSangoli