In a site I am managing, I have this styled link that on click fades in a drop list below it, so that the user can select a genre.
I have the Fade in working perfectly, the issue I am running into is trying to determine whether or not the drop down list was hovered on so that I can hide it if the user hovers off of the styled link without entering the drop down list.
So, the drop down list Fades in, the user doesn't enter the drop downed element, then the element fades out, however, if the user enters the drop downed element (while leaving the clicked linked that trigger the fadein) then the drop down should stay shown until leaving the drop down element.
Here is the code I have so far:
$('#categories_link').live('click mouseleave', function(e){
$('.categories').fadeIn(200, function(){
$(this).live('mouseenter mouseleave', function(evnt){
switch(evnt.type) {
case "mouseenter":
$(this).stop(true, true)
$(this).data('visible', true)
break;
case "mouseleave":
$(this).data('visible', false)
break;
}
})
if(e.type == 'mouseleave') {
if($('.categories').data('visible'))
return;
else
$('.categories').fadeOut(200)
}
})
})