I need to setup a hover button that can show a popup image when hovered and remove the popup image when hover out. My problem is that when I hover the button, the popup image pops and covers the button so it fires the hoverout event and remove the popup image even though the cursor is still on the button. How can I resolve this?
$('.test').hover(function(){
imageId=$(this).next().attr('id');
$('#div-' + imageId).show(150);
},function (){
$('#div-' + imageId).hide(150);
})
I’d suppose the popup image doesn’t cover entirely the thumbnail (or this would be trivial : simply fire the mouselave event on the popup image). Then this is a frequent problem with bubbles and menu. You have similar problems if the popup contains other mousehover sensitive areas.
You can register mouseleave events both on the thumb and the popup, and check for both if the mouse is still on target when you receive the event.
You can use this function :
If it returns true, the mouse is still hover the popup image or the thumbnail so the popup shouldn’t be closed.