I have created a drop down with jQuery that can be seen here by clicking the Preview button on top:
var open_submenu = null;
$(function(){
$('.dropdown').hover(function(){
// hide all previous submenus and fix queue buildup problem
$('.sublinks').stop(false, true).hide();
// get corresponding submenus
var submenu = $(this).parent().next();
$(this).parent().nextAll().stop();
$(submenu).css({
top: $(this).offset().top + $(this).height() + 4 + 'px',
left: $(this).offset().left + 'px',
zIndex:10000
});
// show the submenu
$(submenu).stop().slideDown(300);
open_submenu = submenu;
submenu.hover(function(){}, function(){
$(this).slideUp(300);
});
}, function(){});
});
It works fine except for one problem. When I hover over the main hover links (blue ones) quickly eg. going horizontally quickly hovering each top menu, the some submenus don't close. How do I make it so that even if I hover fast over them all other submenus are closed?
Edit
I saw this useful link using some ways to avoid this, but having bit of problems, how to apply that in my case.