// GNB ¸¶¿ì½º À̺¥Æ® $(function() { $("#gnb > li").bind('mouseenter mouseleave click', function(e) { var winWidth = $(window).width(); if(e.type === 'mouseenter') { if(winWidth > 768) { $("#gnb > li").removeClass('on'); $(this).addClass('on'); $("#gnb > li > ul.submnu").fadeOut(300); if($(this).find('ul.submnu').length > 0) { $(this).find('ul.submnu').stop(true,false).fadeIn(300); } } } if(e.type === 'mouseleave') { if(winWidth>768) { $("#gnb > li").removeClass('on'); $("#gnb > li > ul.submnu").stop(true,false).fadeOut(300); } } }); $("#gnb > li > a").click(function(e) { var winWidth = $(window).width(); if(winWidth <= 768) { e.preventDefault(); if(!$(this).parent('li').hasClass('open')) { $("#gnb > li").removeClass('open'); $(this).parent('li').addClass('open'); $("#gnb > li > ul.submnu").stop(true,false).slideUp(300); $(this).siblings('ul.submnu').stop(true,false).slideDown(300); } else { $(this).parent('li').removeClass('open'); $(this).siblings('ul.submnu').stop(true,false).slideUp(300); } } }); }); // ¸Þ´º È£Ãâ $(function() { // ¸Þ´º È£Ãâ¹öÆ° Ŭ¸¯½Ã $("#gnbOpen").click(function() { if(!$("#nav_mask").is(':visible')) { openNav(); } }); // ¸Þ´º ´Ý±â¹öÆ° Ŭ¸¯½Ã $("#gnbClose").click(function() { closeNav(); }); // ¸¶½ºÅ© ¿µ¿ª Ŭ¸¯½Ã¿¡µµ ¸Þ´º ´ÝÀ½ $("#nav_mask").click(function() { closeNav(); }); // ¸Þ´º Ŭ¸¯½Ã $("#gnb > ul > li > a").bind('click touchstart', function(e) { var $submnu = $(this).siblings('ul'); if($submnu.length > 0) { e.preventDefault(); $("#gnb > ul > li > ul.submnu").css('display','none'); $submnu.css({display:'block', left:'100%'}); $submnu.stop(true,false).animate({left:'-20px'}, 500, 'easeOutCubic', function() { setMnuHeight('animate'); $submnu.stop(true,false).animate({left:'20px'}, 100, function() { $submnu.stop(true,false).animate({left:0}, 100); }); }); } }); // Àüü¸Þ´º ¿­±â function openNav() { $("#gnbOpen").addClass('open'); $("#nav_mask").stop(true,false).delay(300).fadeIn(300); $("#navigation").stop(true,false).delay(300).animate({right:0}, 500, 'easeOutCubic'); } // Àüü¸Þ´º ´Ý±â function closeNav() { $("#gnbOpen").removeClass('open'); $("#navigation").stop(true,false).animate({right:'-290px'}, 500, 'easeOutCubic', function() { $("#nav_mask").stop(true,false).fadeOut(300); }); } }); // »ó´ÜÀ¸·Î ½ºÅ©·Ñ ¹öÆ° À̺¥Æ® $(function() { // ¹öÆ° Ŭ¸¯½Ã È­¸é »ó´ÜÀ¸·Î ½ºÅ©·Ñ $("#scrollTop a").click(function(e) { e.preventDefault(); $("html, body").stop(true,false).animate({scrollTop:0}, 400, 'easeOutCubic'); }); // ¸¶¿ì½º À̺¥Æ® ó¸® $("#scrollTop a").mouseenter(function() { if(!$(this).hasClass('on')) { $(this).addClass('on'); } }).mouseleave(function() { $(this).removeClass('on'); }); }); // ½ºÅ©·Ñ À̺¥Æ® $(function() { var scrollH = $(document).height() - $(window).height(); var subMaxOpacity = 80 / scrollH; $(window).scroll(function() { var wTop = $(this).scrollTop(); var winWidth = $(this).width(); // ½ºÅ©·Ñ È°¼ºÈ­ ó¸® ÇÔ¼ö function scrollActive() { if(!$("#header").hasClass('scroll')) { $("#header").addClass('scroll'); $("#scrollTop").stop(true,false).fadeIn(300); } } // ½ºÅ©·Ñ ºñÈ°¼ºÈ­ ó¸® ÇÔ¼ö function scrollInactive() { $("#header").removeClass('scroll'); $("#scrollTop").stop(true,false).fadeOut(300); } if($("body").hasClass('main')) { if(winWidth > 1024) { if(wTop >= 750) { scrollActive(); } else { scrollInactive(); } } else if (winWidth>768 && winWidth <= 1024) { if(wTop >= 500) { scrollActive(); } else { scrollInactive(); } } else { if(wTop >= 380) { scrollActive(); } else { scrollInactive(); } } } else { if(winWidth > 1024) { if(wTop >= 750) { scrollActive(); } else { scrollInactive(); } } else if (winWidth>768 && winWidth <= 1024) { if(wTop >= 500) { scrollActive(); } else { scrollInactive(); } } else if (winWidth>640 && winWidth <= 768) { if(wTop >= 380) { scrollActive(); } else { scrollInactive(); } } else if (winWidth>480 && winWidth <= 640) { if(wTop >= 250) { scrollActive(); } else { scrollInactive(); } } else { if(wTop >= 225) { scrollActive(); } else { scrollInactive(); } } } // ¼­ºê ºñÁÖ¾ó ½ºÅ©·Ñ½Ã ¸¶½ºÅ© ¹è°æ Åõ¸íµµ ó¸® var subOpacity = (subMaxOpacity*wTop)*0.03; $("#sub_visual > .scrollbg").css('opacity',subOpacity); }); }); // ¼­ºêÆäÀÌÁö °øÅë ÇÔ¼ö $(function() { // ¼­ºê ºñÁÖ¾ó À̹ÌÁö ÆäÀÌµå º¯¼ö Á¤ÀÇ var sIndex = 0; var sTimer; var sInterval = 4000; // ¼­ºê ºñÁÖ¾ó À̹ÌÁö Ãʱâ¼ÂÆà function subImgInit() { $("#sub_visual ul li:last").after($("#sub_visual ul li[data-idx=" + sIndex + "]")); } // ¼­ºê ºñÁÖ¾ó À̹ÌÁö ÆäÀ̵å ÇÔ¼ö function subFade() { var count = $("#sub_visual ul li").length; sIndex++; if(sIndex>=count) { sIndex = 0 } $("#sub_visual ul li").removeClass('active'); $("#sub_visual ul li:last").after($("#sub_visual ul li[data-idx=" + sIndex + "]")); $("#sub_visual ul li[data-idx=" + sIndex + "]").addClass('active'); $("#sub_visual ul li[data-idx=" + sIndex + "]").stop(true,false).animate({opacity:0}, 0); $("#sub_visual ul li[data-idx=" + sIndex + "]").stop(true,false).animate({opacity:1}, 800); } // ¼­ºê ºñÁÖ¾ó ŸÀÌƲ È°¼ºÈ­ function initTitle() { var majorTitle = $("#nav .depth1 > a > span").text(); var minorTitle = $("#nav .depth2 > a > span").text(); $("#sub_visual > .title > h2").text(majorTitle); $("#sub_visual > .title > h3").text(minorTitle); } // ¼­ºê ºñÁÖ¾ó À̹ÌÁö ÀÚµ¿ ÆäÀ̵å sTimer = setInterval(function() { subFade(); }, sInterval); // 1Â÷ µå·Ó´Ù¿î ¸Þ´º È°¼ºÈ­ function majorActive() { var currIndex = $("#container").data('menu') - 1; var currMenu = $("#nav .depth1 ul.mnuList li").eq(currIndex).text(); $("#nav .depth1 > a > span").text(currMenu); } // 2Â÷ µå·Ó´Ù¿î ¸Þ´º È°¼ºÈ­ function minorActive() { var currIndex = $("#container").data('sub') - 1; var currMenu = $("#nav .depth2 ul.mnuList li").eq(currIndex).text(); $("#nav .depth2 > a > span").text(currMenu); } // µå·Ó¹Ú½º ¸Þ´º Ŭ¸¯ ó¸® $("#nav .dropdown > a").click(function() { if(!$(this).parent('.dropdown').hasClass('open')) { $("#nav .dropdown").removeClass('open'); $("#nav .dropdown > ul.mnuList").stop(true,false).fadeOut(200); $(this).parent('.dropdown').addClass('open'); $(this).siblings('ul.mnuList').stop(true,false).fadeIn(200); } else { $(this).parent('.dropdown').removeClass('open'); $(this).siblings('ul.mnuList').stop(true,false).fadeOut(200); } }); // ¼­ºê ÆäÀÌµå ºñÁÖ¾ó ¹× µå·Ó¹Ú½º ¸Þ´º µ¿±âÈ­ $(window).load(function() { subImgInit(); majorActive(); minorActive(); initTitle(); }); });