var winWidth, winHeight, winPos; $(function($) { winWidth = $(window).width(); winHeight = $(window).height(); winPos = $(window).scrollTop(); /* 2depth */ $(".gnbMenu > li > a").on("click",function(e) { $(".searchMask, .allMenuMask, .gnbMask").hide(); if ( $(this).hasClass("nochild") ) { // 1李⑤찓�대쭔 �덈뒗 �섏씠吏�뿉�쒕뒗 諛붾줈 �대룞 161219 G-Daerigon } else { e.preventDefault(); $(".gnbMenu > li > a").removeClass("on"); $(this).addClass("on"); var parWrap = $(this).parents(".gnbWrap"); var nextMenu = $(this).next(".gnbSubMenu"); if( parWrap.hasClass("opened") ) { if ( nextMenu.css("display") == "block" ) { } else { $(".gnbSubMenu").hide().removeAttr("tabindex"); nextMenu.attr("tabindex","0").show().focus(); } } else { if ( nextMenu.css("display") == "block" ) { } else { $(".gnbSubMenu").hide().removeAttr("tabindex"); nextMenu.slideDown(250); setTimeout(function() { nextMenu.attr("tabindex","0").focus(); },250); parWrap.removeClass("opened").addClass("opened"); } } } }); $(".gnbSubClose").on("click",function(e) { e.preventDefault(); var parMenu = $(this).parents(".gnbSubMenu"); var parLink = $(this).parents("li").find("a"); parMenu.slideUp(250); setTimeout(function() { parLink.focus(); // focus parMenu.removeAttr("tabindex"); $(".gnbWrap").removeClass("opened"); $(".gnbMenu > li > a").removeClass("on"); },250); }); $(document).on("click", ".gnbTopArea .gnbBox .mobileBtn button", function() { winWidth = $(window).width(); if (winWidth < 1024 ) { //$(this).parents(".gnbBox").find(".btns").slideToggle(300); //$(".gnbTopArea .gnbBox .btns").slideToggle(300); $(this).parent().toggleClass("on"); } }); /* all menu */ $(".allMenu").click(function() { var mask = $(this).parent().next(".allMenuMask"); var menuInfo = $(this).parent().next().next(".allMenuInfo"); $(".searchMask, .gnbMask").hide(); $(".gnbSubMenu").hide(); $(".wrapperArea").addClass("fixed"); $(".gnbTopArea").removeClass("behind").addClass("behind"); mask.fadeIn(150); menuInfo.fadeIn(150); setTimeout(function() { menuInfo.attr("tabindex","0").focus(); },150); $("body").css("overflowY","hidden"); }); $(".allMenuClose, .allMenuMask, .gnbMask").click(function() { $(".wrapperArea").removeClass("fixed"); $(".allMenuMask").fadeOut(150); $(".allMenuInfo").fadeOut(150); setTimeout(function() { $(".allMenu").focus(); $(".allMenuInfo").removeAttr("tabindex"); $(".gnbWrap").removeClass("opened"); $(".gnbMenu > li > a").removeClass("on"); $(".gnbTopArea").removeClass("behind"); },150); $("body").css("overflowY","auto"); }); winWidth = $(window).width(); winHeight = $(window).height(); if( winWidth >= 768 ) { if ( winHeight <= 900 ) { $(".allMenuWrap").css("height", (winHeight/1.5)-($(".gnbTopArea").height() + $(".gnbWrap").height())+"px"); } else { $(".allMenuWrap").css("height", "100%"); $(".allMenuWrap").css("maxHeight", "720px"); } } else { $(".allMenuWrap").css("maxHeight", (winHeight*0.9)-($(".gnbTopArea").height() + $(".gnbWrap").height())+"px"); } $(window).resize(function() { winWidth = $(window).width(); winHeight = $(window).height(); if( winWidth >= 768 ) { if ( winHeight <= 900 ) { $(".allMenuWrap").css("height", (winHeight/1.5)-($(".gnbTopArea").height() + $(".gnbWrap").height())+"px"); } else { $(".allMenuWrap").css("height", "100%"); $(".allMenuWrap").css("maxHeight", "720px"); } } else { $(".allMenuWrap").css("maxHeight", (winHeight*0.9)-($(".gnbTopArea").height() + $(".gnbWrap").height())+"px"); } }); /* all menu for mobile */ $(document).on("click", ".allMenuWrap .allMenuArea h2", function(e) { if ( $(this).parent().hasClass("nochild") ) { } else { $(this).toggleClass("on"); } }); $(document).on("click", ".allMenuWrap .allMenuArea .allMenuBox > ul > li > a", function(e) { if (winWidth < 1024 ) { if ( $(this).parent().hasClass("nochild") ) { } else { e.preventDefault(); $(this).parent().toggleClass("on"); /* 2017.02.16 �섏쐞硫붾돱�� 硫붾돱留곹겕媛� �ㅻⅨ寃쎌슦 泥섎━. if ( $(this).attr("href") != $(this).next("ul").find("li").eq(0).find("a").attr("href") ) { $(this).toggleClass("link"); } */ } } else { } }); /* search */ $(".btnSearch").click(function() { $(".allMenuMask, .gnbMask").hide(); $(".gnbSubMenu").hide(); $(".wrapperArea").addClass("fixed"); $(".gnbTopArea").removeClass("behind").addClass("behind"); $(".searchMask").fadeIn(150); $(".searchWrap").fadeIn(150); // $("#goodList").load(searchGoodURL, { tquery: queryId }, function() { // }); setTimeout(function() { $("#topquery").attr("tabindex","0").focus(); },150); }); $(".btnSearchClose, .searchMask, .gnbMask").click(function() { $(".wrapperArea").removeClass("fixed"); $(".searchMask").fadeOut(150); $(".searchWrap").fadeOut(150); setTimeout(function() { $(".btnSearch").focus(); $("#topquery").removeAttr("tabindex"); $(".gnbTopArea").removeClass("behind"); },150); }); /* search result */ $(".boardTb ul li").on("click", function() { $(".boardTb ul li").removeClass("on"); $(this).toggleClass("on"); }); /* TOPNAVI */ /* $(".topNaviMenu1 > a, .topNaviMenu2 > a, .topNaviMenu3 > a").hover( function() { $(this).removeClass("on").addClass("on"); $(this).next("ul").removeClass("on").addClass("on"); }, function() { //$(this).removeClass("on"); } ); $(".topNavi .innerWrap2 > ul > li > ul").hover( function() { //$(this).removeClass("on").addClass("on"); }, function() { $(this).removeClass("on"); } ); */ $(document).on("click", ".topNaviMenu1 > a, .topNaviMenu2 > a, .topNaviMenu3 > a", function(e) { e.preventDefault(); if ( $(this).next("ul").hasClass("on") ) { $(this).next("ul").removeClass("on"); } else { $(this).next("ul").removeClass("on").addClass("on"); } }); $(document).on("click", ".topNaviFunc ul li.topNaviLink > a", function(e) { e.preventDefault(); $(this).toggleClass("on"); $(".topNaviPop").fadeToggle(150); }); /* LNB*/ $(".lnb > ul > li > a").each(function() { $(this).click(function(e) { if ( $(this).parent().hasClass("nochild") ) { } else { if ( $(this).hasClass("on") ) { // $(this).next("ul").slideUp(150).end().removeClass("on"); // 161114 netive G-Daerigon } else { e.preventDefault(); $(".lnb a.on + ul").slideUp(150); $(".lnb > ul > li > a").removeClass("on"); $(this).next("ul").slideDown(150).end().addClass("on"); } } }); }); // footer select $(document).on("click", ".footerLinkWrap .toggleSelect", function() { $(".footerLinkWrap .selectLink > ul").toggleClass("on"); }); // Selectbox $('.selectBox select').each(function() { var sel_text = $(this).find('>option:selected').text(); //$(this).prev().empty().text(sel_text); $(this).parent().find("span").empty().text(sel_text); // 2017.01.31 netive. added label for WebAcc. }); $(document).on('change', '.selectBox select', function() { var sel_text = $(this).find('>option:selected').text(); //$(this).prev().empty().text(sel_text); $(this).parent().find("span").empty().text(sel_text); // 2017.01.31 netive. added label for WebAcc. }); $(document).on('focus', '.selectBox', function() { $(this).addClass('focus'); }); $(document).on('blur', '.selectBox', function() { $(this).removeClass('focus'); }); /* select for email */ $(document).on("change", ".emailBox .selectBox select", function() { var sel_val = $(this).find('>option:selected').val(); if ( sel_val == 'self' ) { $(".inputEmail2 input[type='text']").val('').focus(); } else { $(".inputEmail2 input[type='text']").val(sel_val); } }); /* radio label */ $(document).on('focus', 'input:radio', function() { $(this).parent().addClass('focus'); }); $(document).on('blur', 'input:radio', function() { $(this).parent().removeClass('focus'); }); $('.addrCheck li p label, .inCk > label, .inCk > li > label').each(function(){ if ( $(this).prev().is(':checked') ) { $(this).removeClass('on').addClass('on'); } }); $(document).on('change', '.inCk input:radio', function() { //$(document).on('change', '.inCk > input:radio, .inCk > li > input:radio', function() { $(this).parents(".inCk").find('label').removeClass('on'); $(this).next("label").addClass('on'); }); $(document).on('change', '.addrCheck li p > input:radio', function() { $(this).parents(".addrCheck").find('label').removeClass('on'); $(this).next("label").addClass('on'); }); /* file upload */ $('.fileBox').each(function(){ $(this).find('.btnFile > .addFile02').change(function(){ var _this = $(this).val(); $(this).parent().prev('.addFile').val(_this); }); }); $('.chkList li').each(function(){ var img = $(this).find("img"); var src = $(img).attr("src"); $(this).find('input').on('change', function(){ if ($(this).is(':checked')) { var imgOn = src.replace(/.png/,"_on.png"); $(img).attr("src", imgOn); $(this).next().addClass('on'); } else { var imgOn = src.replace(/_on.png/,".png"); $(img).attr("src", imgOn); $(this).next().removeClass('on'); } }); }); /* faq */ $(".faqList dl dt a").on("click", function() { if($(this).parent().next().css("display") == "none") { $(".faqList dl dt a").removeClass('on'); $(".faqList dl dd").slideUp(150); $(this).addClass('on'); $(this).parent().next().slideDown(150); } else { $(".faqList dl dt a").removeClass('on'); $(".faqList dl dd").slideUp(150); } }); if( winPos > $(".gnbTopArea").height() + $(".gnbWrap").height() ) { if( $(".gnbWrap").hasClass("fixed") ) { } else { $(".gnbWrap").addClass("fixed"); if( winWidth < 768 ) { $(".searchWrap").addClass("fixed"); } } } else { if( $(".gnbWrap").hasClass("fixed") ) { $(".gnbWrap").removeClass("fixed"); if( winWidth < 768 ) { $(".searchWrap").removeClass("fixed"); } } } $(window).scroll(function() { winWidth = $(window).width(); winPos = $(window).scrollTop(); /* if( winPos > $(".gnbTopArea").height() + $(".gnbWrap").height() ) { if( $(".gnbWrap").hasClass("fixed") ) { } else { $(".gnbWrap").stop().animate({top:0}, 50).addClass("fixed"); if( winWidth < 768 ) { $(".searchWrap").stop().animate({top: $(".gnbWrap").height() }, 50); } } } else { if( $(".gnbWrap").hasClass("fixed") ) { $(".gnbWrap").removeClass("fixed").stop().animate({top: $(".gnbTopArea").height() }, 50); if( winWidth < 768 ) { $(".searchWrap").stop().animate({top: $(".gnbTopArea").height() + $(".gnbWrap").height() }, 50); } } } */ if( winPos > $(".gnbTopArea").height() + $(".gnbWrap").height() ) { if( $(".gnbWrap").hasClass("fixed") ) { } else { $(".gnbWrap").addClass("fixed"); if( winWidth < 768 ) { $(".searchWrap").addClass("fixed"); } } } else { if( $(".gnbWrap").hasClass("fixed") ) { $(".gnbWrap").removeClass("fixed"); if( winWidth < 768 ) { $(".searchWrap").removeClass("fixed"); } } } }); });