/* 동영상 레이어팝업 */ $(function(){ //메인 해상도에따른 새로고침 var winW = $(window).width(); $(window).resize(function(){ var winW2 = $(window).width(); if(winW <= 1024){ if(winW2 > 1024){ location.reload(); winW=1025; } } if(winW > 1024){ if(winW2 <= 1024){ location.reload(); winW=1023; } } //console.log(winW, winW2); }); /* 메인-전체영역 : 마우스 휠 & 버튼 */ if($(window).width() > 1024){ mouseWheel.init().action(); } /* 메인-영역1 : 광고 배너 */ $('.banner1 .btnCont span a').on({ click : BANNER.area1Ad}); /* 메인-영역4 : 포토제닉 배너 */ $('.photoWrap > a').on({ click : BANNER.area4Photo }); mainBtn(); }); function mainBtn(){ $('.playM').click(function(ev) { ev.preventDefault(); var _this =$(this); var vCont = _this.attr('href'); var $target = $(vCont); try{ if(eval($target.attr('id')+"(this)") == false){ return false; } }catch(e){ } $('
').insertBefore($(this)); $('header, .headerSlide, .btn').addClass('swapIndex'); $(".section3 .closeGroup").stop().css("opacity","1"); $('#bgLayer').fadeTo('fast', 0.6, function() { $(vCont).show(0,function() {}); $('.popClose').click(function() { $('iframe').attr('src', $('iframe').attr('src')); $('#bgLayer').remove(); $('header, .headerSlide, .btn').removeClass('swapIndex'); $(this).parents('.layerpop').hide(300); }); }); }); } // IMPORT PlugIn : changeImage $.fn.changeImage = function( type01, type02 ){ return this.each(function(){ var that = $(this), current_src= that.attr("src"), type_val01= current_src.indexOf("_"+type01+"."), type_val02= current_src.indexOf("_"+type02+"."); if(type_val01 != -1){ that.attr("src", that.attr("src").replace("_"+type01, "_"+type02)); }else if(type_val02 != -1){ that.attr("src", that.attr("src").replace("_"+type02, "_"+type01)); } }); }; // 배너 var BANNER = { area1Ad : function() { var liIndex = $(this).parent().index(); if($(this).parent().is('.on')) return false; $('.banner1 .btnCont span a img').each(function() { $(this).attr("src", $(this).attr("src").replace("_on", "_off")); }); $(this).find('img').changeImage('off', 'on'); $(this).parent().addClass('on').siblings().removeClass('on'); $('.banerSlide1 ul li') .each(function() { $(this).hide(); }) .eq(liIndex).show(); return false; }, area4Photo : function() { var aName = $(this).attr('href').substr(1), ROOT = '.genicWrap ul li'; switch( aName ) { case 'prev' : $(ROOT + ':last-child').insertBefore(ROOT + ':first-child'); break; case 'next' : $(ROOT + ':first-child').insertAfter(ROOT + ':last-child'); break; } return false; } }; // 메인 - 마우스휠 & 버튼 var conWrapSize = 0, preConWrapNum = 0, conWrapNum = 0, wheelStatus = false, // down : false, up : true mouseWheel = { init : function() { if($(window).width() > 990){ $('#mainCon1') .show().addClass('active') .find('section .textShin').fadeIn(1000) // .next().show().find('.ab') // .eq(0).delay(250).fadeIn(250, function() { // $(this).next().delay(250).fadeIn(250, function() { // $(this).next().delay(250).fadeIn(250, function() { // $(this).next().delay(250).fadeIn(250, function() { // $(this).next().delay(250).fadeIn(250); // }); // }); // }); // }) .closest('section').find('article').delay(1700) .fadeIn(1500) .closest('body').find('.btn').delay(1500).fadeIn(1000); return this; } }, action : function() { var ieTimeout, ieSpeed = 100, browserVer = navigator.appVersion.toLowerCase(), clickNscroll = '', moveStatus = true, preScroll = 1, textShinLoc = { mainCon1 : { top : -10, left : 505 }, mainCon2 : { top : 60, left : 145 }, mainCon3 : { top : 90, left : 760 }, mainCon4 : { top : -20, left : 720 } }, clickMoveStatus = true, preClick = 1; conWrapSize = $('#content .conWrap').length; var MOTION = { scrollActivation : function() { // IE if(browserVer.indexOf('msie') != -1) { // IE TYPE (( browserVer.indexOf('msie 7.0') != -1 ) || ( browserVer.indexOf('msie 8.0') != -1 )) ? (function(){ ieSpeed = 100; }()) : (function(){ ieSpeed = 10000; }()); $('html').bind('mousewheel', function(event){ event.preventDefault(); wheelDelta = event.originalEvent.wheelDelta; clearTimeout(ieTimeout); ieTimeout = setTimeout(function() { if(wheelDelta < 0) { conWrapNum++; if( conWrapNum >= conWrapSize ) conWrapNum = (conWrapSize - 1); wheelStatus = false; } else { conWrapNum--; if( conWrapNum < 0 ) conWrapNum = 0; wheelStatus = true; } if(conWrapNum != preConWrapNum) { if( moveStatus ) { MOTION.scrollAction(); clickNscroll = 'scroll'; } } }, ieSpeed); }); } // OTHERS $(window).mousewheel(function(event, delta) { event.preventDefault(); window.mousewheelDelta = delta; clearTimeout($.data(this, 'timer')); $.data(this, 'timer', setTimeout(function() { if(mousewheelDelta < 0) { conWrapNum++; if( conWrapNum >= conWrapSize ) conWrapNum = (conWrapSize - 1); wheelStatus = false; } else { conWrapNum--; if( conWrapNum < 0 ) conWrapNum = 0; wheelStatus = true; } if(conWrapNum != preConWrapNum) { if( moveStatus ) { MOTION.scrollAction(); clickNscroll = 'scroll'; } } }, 250)); }); }, scrollAction : function() { var prevNum = conWrapNum, currentNum = prevNum + 1, nextNum = currentNum + 1; if(wheelStatus) { // down defaultMoving( nextNum ); } else { // up defaultMoving( prevNum ); } function defaultMoving( locValue ) { moveStatus = false; var locValueTxt = ''; if(clickNscroll == 'scroll') { locValueTxt = 'mainCon' + preScroll; } else { locValueTxt = 'mainCon' + preClick; } $('#content > div') .filter('.active').find('.closeGroup').fadeOut(100) .siblings('.textShin').animate({ top : textShinLoc[ 'mainCon' + currentNum ].top, left : textShinLoc[ 'mainCon' + currentNum ].left }, 700, function() { var speed = 500, motionType = 'easeInOutExpo'; $(this) .css({ top : textShinLoc[locValueTxt].top, left : textShinLoc[locValueTxt].left }) .closest('.conWrap').removeClass('active').hide(); if(currentNum == 1) { $('#mainCon2 .balloon').css({ width : 0, height : 0 }); $('#mainCon1') .show().addClass('active') .find('section .textShin').show() // .next().show().find('.ab') // .eq(0).delay(250).fadeIn(250, function() { // $(this).next().delay(250).fadeIn(250, function() { // $(this).next().delay(250).fadeIn(250, function() { // $(this).next().delay(250).fadeIn(250, function() { // $(this).next().delay(250).fadeIn(250); // }); // }); // }); // }) .closest('section').find('article').delay(2000) .fadeIn(1500) .closest('body').find('.btn').delay(1500).fadeIn(1000, function() { moveStatus = true; }); } else if(currentNum == 2) { $('#mainCon1 .visual3 .ab').hide(); $('#mainCon2') .show().addClass('active') .find('section .textShin').show() .next().show() .find('.balloon') .eq(0).animate({ width: 200, height: 208 }, speed, motionType) .end().delay(250) .eq(1).animate({ width: 155, height: 152 }, speed, motionType) .end().delay(250) .eq(2).animate({ width: 189, height: 184 }, speed, motionType) .closest('section').find('article').delay(1200) .fadeIn(1500) .closest('body').find('.btn').delay(1500).fadeIn(1000, function() { moveStatus = true; }); } else { $('#mainCon' + currentNum) .show().addClass('active') .find('section .textShin').show() .next().delay(300).fadeIn(1500) .closest('section').find('article').delay(1500) .fadeIn(1500) .closest('body').find('.btn').delay(1500).fadeIn(1000, function() { moveStatus = true; }); $('#mainCon2 .balloon').css({ width : 0, height : 0 }); } }); } $('.btn ul li a img').each(function() { $(this).attr("src", $(this).attr("src").replace("_on", "_off")); }); $('.btn ul li') .removeClass('on') .eq(conWrapNum).addClass('on') .find('img').changeImage('off', 'on'); preConWrapNum = conWrapNum; preScroll = currentNum; }, clickAction : function() { if(clickMoveStatus) { var clickIndex = $(this).parent().index(), clickNum = clickIndex + 1, preClickTxt = ''; clickMoveStatus = false; if($(this).parent().is('.on')) return false; $(this).parent().addClass('on').siblings().removeClass('on'); $('.btn ul li a img').each(function() { $(this).attr("src", $(this).attr("src").replace("_on", "_off")); }); $('.btn ul li') .removeClass('on') .eq(clickIndex).addClass('on') .find('img').changeImage('off', 'on'); if(clickNscroll == 'click') { preClickTxt = 'mainCon' + preClick; } else { preClickTxt = 'mainCon' + preScroll; } $('#content > div') .filter('.active').find('.closeGroup').fadeOut(100) .siblings('.textShin').animate({ top : textShinLoc[ 'mainCon' + clickNum ].top, left : textShinLoc[ 'mainCon' + clickNum ].left }, 700, function() { var speed = 500, motionType = 'easeInOutExpo'; $(this) .css({ top : textShinLoc[preClickTxt].top, left : textShinLoc[preClickTxt].left}) .closest('.conWrap').removeClass('active').hide(); $('#mainCon1 .visual3 .ab').hide(); $('#mainCon2 .balloon').css({ width : 0, height : 0 }); if(clickNum == 1) { $('#mainCon1') .show().addClass('active') .find('section .textShin').show() // .next().show().find('.ab') // .eq(0).delay(500).fadeIn(500, function() { // $(this).next().delay(500).fadeIn(500, function() { // $(this).next().delay(500).fadeIn(500, function() { // $(this).next().delay(500).fadeIn(500, function() { // $(this).next().delay(500).fadeIn(500); // }); // }); // }); // }) .closest('section').find('article').delay(5500) .fadeIn(1500) .closest('body').find('.btn').delay(1500).fadeIn(1000, function() { clickMoveStatus = true; }); } else if(clickNum == 2) { $('#mainCon2') .show().addClass('active') .find('section .textShin').show() .next().show().find('.balloon') .eq(0).animate({ width: 200, height: 208 }, speed, motionType) .end().delay(250) .eq(1).animate({ width: 155, height: 152 }, speed, motionType) .end().delay(250) .eq(2).animate({ width: 189, height: 184 }, speed, motionType) .closest('section').find('article').delay(1200) .fadeIn(1500) .closest('body').find('.btn').delay(1500).fadeIn(1000, function() { clickMoveStatus = true; }); } else { $('#mainCon' + clickNum) .show().addClass('active') .find('section .textShin').show() .next().delay(300).fadeIn(1500) .closest('section').find('article').delay(1500) .fadeIn(1500) .closest('body').find('.btn').delay(1500).fadeIn(1000, function() { clickMoveStatus = true; }); $('#mainCon2 .balloon').css({ width : 0, height : 0 }); } }); conWrapNum = clickIndex; preClick = clickNum; clickNscroll = 'click'; } } }; // FUNCTION ACTIVATION if($(window).width() > 990){ MOTION.scrollActivation(); $('.btn ul li > a').on({ click : MOTION.clickAction }); } } };