$(function () { // ¸Þ´º È£Ãâ¹öÆ° Ŭ¸¯½Ã $("#gnbOpen").bind('click touchstart', function () { if (!$("#gnbMask").is(':visible')) { openNav(); } }); // ¸Þ´º ´Ý±â¹öÆ° Ŭ¸¯½Ã $("#gnbClose").bind('click touchstart', 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'); $("#gnbOpen").stop(true, false).delay(300).animate({ opacity: '0' }, 300); $("body").css('overflow-x', 'hidden'); $("#gnb ul").css({ left: '100%' }); $("#navigation").stop(true, false).fadeIn(300, function () { $("#gnb > ul").stop(true, false).animate({ left: '-20px' }, 500, 'easeOutCubic', function () { $("#gnb > ul").stop(true, false).animate({ left: '20px' }, 100, function () { $("#gnb > ul").stop(true, false).animate({ left: '0' }, 100, function () { $("body").removeAttr('style'); }); }); }); }); $("#gnbClose").stop(true, false).delay(400).fadeIn(300); setMnuHeight(); } // Àüü¸Þ´º ´Ý±â function closeNav() { $("#gnbOpen").removeClass('open'); $("#navigation").stop(true, false).fadeOut(300, function () { $("#gnbClose").css('display', 'none'); $("#gnbOpen").stop(true, false).animate({ opacity: '1' }, 300); subMnuClose(); }); } // Àüü¸Þ´º ÇÏÀ§¸Þ´º ¼û±â±â function subMnuClose() { $("#gnb > ul > li > ul.submnu").css('display', 'none'); } // Àüü¸Þ´º ¼¼·Î À§Ä¡°ª Á¶Àý function setMnuHeight(option) { var wHeight = $(window).height(); var mnuHeight = $("#nav_wrap").height(); if (option === 'animate') { $("#nav_wrap").stop(true, false).animate({ top: (wHeight - mnuHeight + 60) / 2 + 'px' }, 300); } else { $("#nav_wrap").css('top', (wHeight - mnuHeight + 60) / 2 + 'px'); } } }); // »ó´ÜÀ¸·Î ½ºÅ©·Ñ ¹öÆ° À̺¥Æ® $(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(); // ½ºÅ©·Ñ È°¼ºÈ­ ó¸® ÇÔ¼ö function scrollActive() { if (!$("#header").hasClass('scroll')) { $("#header").addClass('scroll'); $("#header").stop(true, false).animate({ top: '-80px' }, 0); $("#header").stop(true, false).animate({ top: '0' }, 300); $("#scrollTop").stop(true, false).fadeIn(300); } } // ½ºÅ©·Ñ ºñÈ°¼ºÈ­ ó¸® ÇÔ¼ö function scrollInactive() { $("#header").stop(true, false).animate({ top: '-80px' }, 300, function () { $("#header").removeClass('scroll'); $("#header").removeAttr('style'); }); $("#scrollTop").stop(true, false).fadeOut(300); } if (wTop >= 80) { scrollActive(); } else { scrollInactive(); } // ¼­ºê ºñÁÖ¾ó ½ºÅ©·Ñ½Ã ¸¶½ºÅ© ¹è°æ Åõ¸íµµ ó¸® var subOpacity = (subMaxOpacity * wTop) * 0.03; $("#sub_visual > .scrollbg").css('opacity', subOpacity); }); }); // ¼­ºêÆäÀÌÁö °øÅë ÇÔ¼ö $(function () { // ¼­ºê ºñÁÖ¾ó À̹ÌÁö ÆäÀÌµå º¯¼ö Á¤ÀÇ var sIndex = 0; var sTimer; var sInterval = 3000; // ¼­ºê ºñÁÖ¾ó À̹ÌÁö Ãʱâ¼ÂÆà 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 }, 500); } // ¼­ºê ºñÁÖ¾ó ŸÀÌƲ È°¼ºÈ­ 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(); }); }); $(window).load(function () { var elem = $(".scrollreveal"); var sty = { 'opacity': '0', 'transition': 'none' } elem.css(sty); $("html, body").animate({ scrollTop: '10' }, 10, function () { $("html, body").animate({ scrollTop: '0' }, 0); }); $(window).bind('scroll', function () { var winWidth = $(this).width(); var winTop = $(this).scrollTop(); var winHeight = $(this).height(); var docHeight = $(document).height(); var hdHeight = $("#header").height(); var elemHeight; var showDelay = 0; if (winWidth > 1024) { if (winTop >= hdHeight) { if (!$("#header").hasClass('fixed')) { $("#header").addClass('fixed'); $("#scrollTop").stop(true, false).fadeIn(300); $("#scrollTop_shop").stop(true, false).fadeIn(300); } } else { $("#header").removeClass('fixed'); $("#scrollTop").stop(true, false).fadeOut(300); $("#scrollTop_shop").stop(true, false).fadeOut(300); } } elem.each(function () { var etop = $(this).offset().top; var eh = $(this).height(); var delay = $(this).data('delay'); if (delay == null) { delay = 100; } if (winTop >= etop - winHeight) { if (!$(this).hasClass('animated')) { var aniOptions; var styR = { 'position': 'relative', 'top': '30px' } var sty = { 'top': '30px' } if ($(this).css('position') == 'static') { aniOptions = { 'opacity': '1', 'top': '0' } $(this).css(styR); } else if ($(this).css('position') == 'absolute') { aniOptions = { 'opacity': '1', } } else { aniOptions = { 'opacity': '1', 'top': '0' } $(this).css(sty); } showDelay += delay; $(this).stop().delay(showDelay).animate(aniOptions, 500, function () { var sty = { 'position': '', 'top': '', 'opacity': '', 'transition': '' } $(this).css(sty); }); $(this).addClass('animated'); } } }); }); }); // ÆäÀÌÁö·Îµå $(window).load(function () { $("#page-loader").fadeOut(600, function () { $("#page-loader").delay(100).remove(); }); });