제이쿼리 질문합니다.

제이쿼리 질문합니다.

QA

제이쿼리 질문합니다.

답변 1

본문

gnb에 마우스 hover했을 때, 서브메뉴 전체가 보이는데

hover 한 메뉴에 속해있는 서브메뉴만 보이도록 코드를 수정하고 싶습니다.

 

 

$(function() {
    var gnb_h = $('#gnb_1dul').height();
    var gnb_h_on = 0;
    var is_gnb_on = false;

    // GNB
    $('.gnb_1dli').each(function() { gnb_h_on = gnb_h_on > $(this).height() ? gnb_h_on : $(this).height(); });
    $('#gnb_1dul').on({
        'focusin': function() {
            is_gnb_on = true;
            $('#gnb h2').show();
            $(this).stop().css({'height': gnb_h_on});
        },
        'mouseover': function() {
            if (is_gnb_on == false) {
                is_gnb_on = true;
                $('#gnb h2').show();
                $(this).stop().clearQueue().animate({height: gnb_h_on}, 400);
            }
        },
        'focusout mouseleave': function() {
            if (is_gnb_on == true) {
                is_gnb_on = false;
                $(this).stop().clearQueue().animate({height: gnb_h}, 200, function() { $('#gnb h2').hide(); });
            }
        }
    });

 

 

 

 

 

제가 사용한 코드는 이거이고,

 

3555072071_1632902577.6613.jpg

 

 

메뉴 코드는 이렇게 짜여져 있습니다.

이 질문에 댓글 쓰기 :

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
filter #gnb ×
전체 21
© SIRSOFT
현재 페이지 제일 처음으로