jQuery/jQuery 기본
제이쿼리 li 메뉴 > depth02 보이기
hyojinny
2022. 10. 31. 10:35

$(function () {
$('#header .gnb>li').on('mouseenter', function () {
// 각 li에 마우스를 올렸을때 자신 안쪽depth02 보여주고 나머지 형제안의 depth02안보이게
$(this).find('.depth02').show().parent().siblings().find('.depth02').hide();
$('#header').addClass('on');
});
$('#header').on('mouseleave', function () {
$('#header').removeClass('on');
// 헤더에서 마우스 빠졌을때만 서브메뉴 안보이게
$('#header .gnb .depth02').hide();
});
});
원본참고