$(function(){ var active = '_active'; //←仮のクラス名 $('.acc ul').hide(); $('.acc a').hover( function() { $(this).parents('ul').addClass(active); var tmp = $(this).next('ul:first'); var h = tmp.height() + 'px'; tmp.addClass(active).animate({height:'show'}); }, function() { $(this).parents('ul').removeClass(active); $(this).next('ul:first').removeClass(active); }); $('.acc li').mouseout(function() { setTimeout((function(elm){return function(){close(elm);};})($(this)) , 200); }); function close(elm) { var tmp = elm.children('ul:first'); if (!tmp.hasClass(active)) tmp.animate({height:'hide'}); } });