/********************************************************************************************************* ## Sub Script ## * º» ½ºÅ©¸³Æ®ÀÇ ÀúÀÛ±ÇÀº (ÁÖ)À¥½º¸®ÆÛºí¸¯¿¡ ÀÖ½À´Ï´Ù. * º» ½ºÅ©¸³Æ®¸¦ ¹«´ÜÀ¸·Î ÀÌ¿ë(¶Ç´Â µµ¿ë)Çϰųª º¹Á¦ ¶Ç´Â ¼öÁ¤ »ç¿ë½Ã ÀúÀ۱ǹý¿¡ ÀǰŠó¹ú¹ÞÀ» ¼ö ÀÖ½À´Ï´Ù. * ±¸¸Å ÈÄ¿¡µµ Á¦ 2Â÷ »çÀÌÆ® µî ¶óÀ̼±½º°¡ Àû¿ëµÇÁö ¾Ê´Â »çÀÌÆ®¿¡ ´ëÇÏ¿© »ç¿ëÀº ±ÝÁöµÇ¾î ÀÖ½À´Ï´Ù. * À§ »çÇ׿¡ ´ëÇÏ¿© À§¹Ý½Ã Àý´ë ÇÕÀÇ´Â ¾ø½À´Ï´Ù ! * date : 2017-03-15 * author : Joo Pil Gue (joofeel00@naver.com) *********************************************************************************************************/ // PC ÇØ»óµµ ¿©ºÎ üũ ÇÔ¼ö function isPC() { var $winWidth = $(window).width(); if($winWidth > 1024) { return true; } else { return false; } } // ÆĶó¸ÞÅÍ °ª °¡Á®¿À±â var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } }; $(document).ready(function() { var depth1 = getUrlParameter('top') - 1; var depth2 = getUrlParameter('sub') - 1; $("#gnb > li").eq(depth1).addClass('active123'); $("#gnb > li").eq(depth1).find('ul').children().eq(depth2).addClass('on'); }); // Çì´õ ¹× GNB °ü·Ã °øÅë ½ºÅ©¸³Æ® $(function() { var $gnb = $("#gnbWrapper"); var $gnbTrigger = $("#gnbTrigger"); var $gnbTrigger_shop = $("#gnbTrigger_shop"); var $logo = $("#logo"); // GNB È°¼ºÈ­ $("#gnb > li").each(function() { var $currIndex = getUrlParameter('top') - 1; if($(this).index() == $currIndex) $(this).addClass('open'); }); // GNB ºñÈ°¼ºÈ­ function gnbdeActive() { $("#gnb > li").removeClass('open'); $("#gnb > li > ul").removeAttr('style'); $gnbTrigger.removeClass('open'); $gnbTrigger_shop.removeClass('open'); $("body").removeClass('lock'); } // GNB ¸¶¿ì½º¿À¹ö $("#gnb > li").mouseenter(function() { var $option = { 'display':'block', 'top':'80px', 'opacity':'0' } if(isPC() === true) { if(!$(this).hasClass('on')) { $(this).addClass('on'); if($(this).find('ul').length > 0) { $(this).find('ul').css($option); TweenMax.to($(this).find('ul'), 0.25, {'opacity':1, 'top':'67px'}); } } } }); // GNB ¸¶¿ì½º¾Æ¿ô $("#gnb > li").mouseleave(function() { var $idx = $(this).index(); var $option = { 'display':'', 'top':'', 'opacity':'' } if(isPC() === true) { $(this).removeClass('on'); if($(this).find('ul').length > 0) { TweenMax.to($(this).find('ul'), 0.25, {'opacity':0, 'top':'80px', onComplete:function() { $("#gnb > li").eq($idx).find('ul').css($option); }}); } } }); // GNB ¸¶¿ì½º¿À¹ö $("#gnb_shop > li").mouseenter(function() { var $option = { 'display':'block', 'top':'80px', 'opacity':'0' } if(isPC() === true) { if(!$(this).hasClass('on')) { $(this).addClass('on'); if($(this).find('ul').length > 0) { $(this).find('ul').css($option); TweenMax.to($(this).find('ul'), 0.25, {'opacity':1, 'top':'67px'}); } } } }); // GNB ¸¶¿ì½º¾Æ¿ô $("#gnb_shop > li").mouseleave(function() { var $idx = $(this).index(); var $option = { 'display':'', 'top':'', 'opacity':'' } if(isPC() === true) { $(this).removeClass('on'); if($(this).find('ul').length > 0) { TweenMax.to($(this).find('ul'), 0.25, {'opacity':0, 'top':'80px', onComplete:function() { $("#gnb_shop > li").eq($idx).find('ul').css($option); }}); } } }); // GNB Ŭ¸¯ $("#gnb > li > a").click(function(e) { if(isPC() === false) { if(!$(this).parent().hasClass('open')) { if($(this).next('ul').length > 0) { e.preventDefault(); $("#gnb > li > ul").stop().slideUp(250); $("#gnb > li").removeClass('open'); $(this).parent().addClass('open'); $(this).next('ul').stop().slideDown(350, 'easeInOutExpo'); } } else { if($(this).next('ul').length > 0) { e.preventDefault(); $(this).parent().removeClass('open'); $(this).next('ul').stop().slideUp(250); } } } }); // ¸ð¹ÙÀϸ޴º Åä±Û¹öÆ° Ŭ¸¯ $gnbTrigger.click(function() { if(!TweenMax.isTweening($gnb)) { if(!$(this).hasClass('open')) { $(this).addClass('open'); $("body").addClass('lock'); TweenMax.to($gnb, 0.5, {left:0, ease:Expo.easeInOut, onComplete:function() { $logo.stop().fadeIn(200); }}); } else { $(this).removeClass('open'); $("body").removeClass('lock'); TweenMax.to($gnb, 0.5, {left:'-100%', ease:Expo.easeInOut}); $logo.stop().fadeOut(100); } } }); // ¸ð¹ÙÀϸ޴º Åä±Û¹öÆ° Ŭ¸¯ $gnbTrigger_shop.click(function() { if(!TweenMax.isTweening($gnb)) { if(!$(this).hasClass('open')) { $(this).addClass('open'); $("body").addClass('lock'); TweenMax.to($gnb, 0.5, {left:0, ease:Expo.easeInOut, onComplete:function() { $logo.stop().fadeIn(200); }}); } else { $(this).removeClass('open'); $("body").removeClass('lock'); TweenMax.to($gnb, 0.5, {left:'-100%', ease:Expo.easeInOut}); $logo.stop().fadeOut(100); } } }); // À©µµ¿ì ¸®»çÀÌ¡ ó¸® $(window).bind('resize', function() { var $winWidth = $(this).width(); if($winWidth > 1024) { $logo.removeAttr('style'); $gnb.removeAttr('style'); gnbdeActive(); } else { if(!$gnbTrigger.hasClass('open')) { $logo.removeAttr('style'); } } }); }); // ¼­ºêÆäÀÌÁö °øÅë ÇÔ¼ö $(function() { // ¼­ºê ºñÁÖ¾ó À̹ÌÁö ÆäÀÌµå º¯¼ö Á¤ÀÇ var sIndex = 0; var sTimer; var sInterval = 6000; // ¼­ºê ºñÁÖ¾ó À̹ÌÁö Ãʱâ¼ÂÆà 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; $("#gnb > li").eq(currIndex).addClass('active'); var currMenu = $("#nav .depth1 ul.mnuList li").eq(currIndex).text(); $("#nav .depth1 > a > span").text(currMenu); } // 2Â÷ µå·Ó´Ù¿î ¸Þ´º È°¼ºÈ­ function minorActive() { var currIndex2 = $("#container").data('menu') - 1; var currIndex = $("#container").data('sub') - 1; $("#gnb > li").eq(currIndex2).find('ul').children().eq(currIndex).addClass('on'); 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(); }); }); $(function() { // ½ºÅ©·Ñ ¹öÆ° À̺¥Æ® $("#scrollTop").bind('mouseenter mouseleave click', function(e) { if(e.type === 'mouseenter') { if(!$(this).hasClass('on')) { $(this).addClass('on'); } } else if(e.type === 'click') { $("html, body").stop().animate({scrollTop:'0'}, 500, 'easeInOutExpo'); } else { $(this).removeClass('on'); } }) }); $(window).load(function() { var wHeight = $(this).height(); $("html, body").stop(true,false).animate({scrollTop:wHeight + 'px'}, 0); $("html, body").stop(true,false).animate({scrollTop:'0'}, 0); }); $(window).scroll(function() { var pos = $(this).scrollTop(); var win = $(window); $(".scrollObj").each(function() { var objPos = $(this).offset().top; var objh = $(this).height(); var winh = win.height(); var _direction = $(this).data('scroll'); var _delay = $(this).data('delay'); if(pos+winh > objPos - 100) { if(!$(this).hasClass('scrollComplete')) { if(_direction==='left') { $(this).css({opacity:0, position:'relative', left:'-50px'}); $(this).delay(_delay).animate({opacity:1, left:''}, 800, 'easeOutCubic'); } else if(_direction==='right') { $(this).css({opacity:0, position:'relative', right:'-50px'}); $(this).delay(_delay).animate({opacity:1, right:''}, 800, 'easeOutCubic'); } else if(_direction==='top') { $(this).css({opacity:0, position:'relative', top:'50px'}); $(this).delay(_delay).animate({opacity:1, top:''}, 800, 'easeOutCubic'); } else if(_direction==='bottom') { $(this).css({opacity:0, position:'relative', top:'-50px'}); $(this).delay(_delay).animate({opacity:1, top:''}, 800, 'easeOutCubic'); } $(this).addClass('scrollComplete'); } } }); }); });