I have a small very simple function.
$('#desk, #chair, #seat, #tablet').hover(
function(){
$(this).find('.hoverBlack').stop().animate({bottom:'0', opacity:'1'},{queue:false,duration:200})
},
function(){
setTimeout(function() {
$('.hoverBlack').stop().animate({bottom:'-62px', opacity:'.5'},{queue:false,duration:800})
},1)
}
)
The problem is that it simply does not work properly. Whenever i hover over one image and quickly hover other .hoverBlack do not animate. What can I do to fix it.
You need to keep a reference to and clear the timeout you’re setting if you go that route (and I wouldn’t see below for a better way), like this:
This still has another issue of current
.hoverBlackvs the others, see below for a solution.To do what you want, you don’t need to have a timeout, just this would work:
The important part of the second is the
.not(), it animates all the other.hoverBlackelements, but not the one inside the current hovered element.