$(document).ready(function(){ /*GNB*/ $('.depth1>li').on({ mouseenter: function(){ window_w = $(window).width(); if(window_w > 1400){ $(this).addClass('open'); $(this).children('.depth2').stop().slideDown(350); } }, mouseleave: function(){ window_w = $(window).width(); if(window_w > 1400){ $('.depth1>li').removeClass('open'); $(this).children('.depth2').stop().slideUp(350); } }, focusin: function(){ $(this).addClass('open'); $(this).children('.depth2').stop().slideDown(350); } }); $('.nav_close').on('click', function(){ $(this).parent().parent().parent().children("a").focus(); $('nav>ul>li').removeClass('open'); $('nav .depth2').hide(); }); //1depth out(재설정) $('.depth1>li>.depth2').on('focusout', function(){ window_w = $(window).width(); if(window_w > 1400){ $('.depth1>li').removeClass('open'); $('.depth1>li>.depth2').stop().slideUp(350); } }); /*전국사업소*/ $(".office").on({ mouseenter: function(){ $('.office').addClass('open'); $(this).children(".layer_box").stop().slideDown(); }, mouseleave: function(){ $('.office').removeClass('open'); $(this).children(".layer_box").stop().hide(); }, focusin: function(){ $('.office').addClass('open'); $(this).children(".layer_box").stop().slideDown(); } }); /*전국사업소 접근성*/ $(".office .layer_box>ul>li:last-child>a").on("focusout", function(){ $(".office .layer_box").stop().hide(); }); /*언어*/ $(".language").on({ mouseenter: function(){ $('.language').addClass('open'); $(this).children(".layer_box").stop().slideDown(); }, mouseleave: function(){ $('.language').removeClass('open'); $(this).children(".layer_box").stop().hide(); }, focusin: function(){ $('.language').addClass('open'); $(this).children(".layer_box").stop().slideDown(); } }); /*언어 접근성*/ $(".language .layer_box>ul>li:last-child>a").on("focusout", function(){ $('.language').removeClass('open'); $(".language .layer_box").stop().hide(); }); /*패밀리사이트*/ $(".familySite").on({ mouseenter: function(){ var window_w = $(window).width(); if(window_w > 1400){ $('.familySite').addClass('open'); $(this).children(".layer_box").stop().slideDown(); } }, mouseleave: function(){ var window_w = $(window).width(); if(window_w > 1400){ $('.familySite').removeClass('open'); $(this).children(".layer_box").stop().hide(); } }, focusin: function(){ var window_w = $(window).width(); if(window_w > 1400){ $('.familySite').addClass('open'); $(this).children(".layer_box").stop().slideDown(); } } }); /*패밀리사이트 접근성*/ $(".familySite .last_a").on("focusout", function(){ $('.familySite').removeClass('open'); $(".familySite .layer_box").stop().hide(); }); /*검색*/ $('.search>a').on('click', function(){ $('.search_box').stop().slideDown(); $('header .header_t').css('z-index','300'); }); $('.search_new_close').on('click', function(){ $('.search_box').stop().slideUp(200); $('.search>a').focus(); $('header .header_t').css('z-index','320'); }); // 접근성 관련 포커스 강제 이동 function accessibilityFocus() { $(document).on('keydown', '[data-focus-prev], [data-focus-next]', function(e){ var next = $(e.target).attr('data-focus-next'), prev = $(e.target).attr('data-focus-prev'), target = next || prev || false; if(!target || e.keyCode != 9) { return; } if( (!e.shiftKey && !!next) || (e.shiftKey && !!prev) ) { setTimeout(function(){ $('[data-focus="' + target + '"]').focus(); }, 1); } }); } function tooltip() { var openBtn = '[data-tooltip]', closeBtn = '.tooltip-close'; function getTarget(t) { return $(t).attr('data-tooltip'); } function open(t) { var showTarget = $('[data-tooltip-con="' + t + '"]'); showTarget.show().focus(); showTarget.find('.tooltip-close').data('activeTarget', t); } function close(t) { var activeTarget = $('[data-tooltip-con="' + t + '"]'); activeTarget.hide(); $('[data-tooltip="' + t + '"]').focus(); } $(document) .on('click', openBtn, function(e){ e.preventDefault(); open(getTarget(e.target)); }) .on('click', closeBtn, function(e) { e.preventDefault(); close($(this).data('activeTarget')); }) } $(document).ready(function(){ tooltip(); accessibilityFocus(); }); // 웹접근성 skipNav메뉴 관련 if(!$("#subtitle").length) $("a[href='#subtitle']").attr("href", "#container"); if($(".skipNav").length > 1) $(".skipNav").last().remove(); //마지막conSection 마진빼기 $(window).resize(function(){ var window_w = $(window).width(); margin(); }); margin(); function margin(){ var window_w = $(window).width(); if(window_w < 1400){ $('#content>.conSection').last().addClass('last'); $('.contentBody>.conSection').last().addClass('last'); $('.wrap_table').css('margin-bottom', '0'); $('.section_wrap_sear>.box_list_menu').last().addClass('last'); $('.art_section>.conSection').last().addClass('last'); $('.smeahp001>.conSection').last().addClass('last'); }else{ $('#content>.conSection').last().removeClass('last'); $('.contentBody>.conSection').last().removeClass('last'); $('.section_wrap_sear>.box_list_menu').last().removeClass('last'); $('.art_section>.conSection').last().removeClass('last'); $('.smeahp001>.conSection').last().removeClass('last'); } } //탭영역 추가(200120) $('.tab_year>li>a').on('click', function(){ var tab_data = $(this).attr('data-tab'); $('.tab_year>li>a').removeClass('on'); $('.tab_content').removeClass('on'); $('.tab_year>li>a').attr("title", ""); $(this).addClass('on').attr("title", "선택됨"); $('#'+tab_data).addClass('on'); }); });