SerginhoLD
возможно есть еще идеи?
спасибо
$(function(){
var timers = [], active = null;
function hide_menu(i){
var div = $('div[name=node'+i+']');
div.removeClass('active');
$('div[name=drop_menu_top]', div).addClass('hidden');
if(active == i)
active = null;
}
// hide menu by Esc key pressed
$(document).keyup(function(e){
if(e.keyCode == 27 && active)
hide_menu(active);
});
$('div.main-menu ul li').each(function(i){
i++;
$(this).hover(
function(i){
return function(){
clearTimeout(timers[i]);
if(active && active != i)
hide_menu(active);
active = i;
var div = $('div[name=node'+i+']');
div.addClass('active');
$('div[name=drop_menu_top]', div).removeClass('hidden');
div.hover(
function(){
clearTimeout(timers[i]);
},
function(){
timers[i] = setTimeout(function(){hide_menu(i)}, 500);
}
);
}
}(i),
function(i){
return function(){
timers[i] = setTimeout(function(){hide_menu(i)}, 500);
}
}(i)
);
});
});