Nips
Nips

Reputation: 13870

mouseover and mouseout and div with images 1px separated

I have div and function mouseover:

$('#mydiv').mouseover(function(){
    $('#otherdiv').show('slow');
});

$('#otherdiv').mouseout(function(){
    $('#otherdiv').hide('slow');
});

but... The #otherdiv on show cover #mydiv and consists of 5 images 1px separated from each other. I want to that #otherdiv disappear after mouseout but I get a blinking.

How to do it?

Upvotes: 3

Views: 163

Answers (2)

Roko C. Buljan
Roko C. Buljan

Reputation: 206171

$('#mydiv').hover(function(){
    $('#otherdiv').stop().show('slow');
}, function(){
    $('#otherdiv').stop().hide('slow');
});

demo jsBin
http://api.jquery.com/hover
http://api.jquery.com/stop

Upvotes: 4

gdoron
gdoron

Reputation: 150263

Try it with stop:

$('#mydiv').mouseover(function(){
    $('#otherdiv').stop().show('slow');
});

$('#otherdiv').mouseout(function(){
    $('#otherdiv').stop().hide('slow');
});

Upvotes: 2

Related Questions