menuFlag = true; sw = $(window).width(); sh = $(window).height(); /************************ @ ready ************************/ $(document).ready(function() { sw = $(window).width(); sh = $(window).height(); set_ui(); gnb(); selectFooter(); selectTmenu(); if($('#wrap').hasClass('sub')){ SubVisual = new subVisual(); } if($('#wrap').hasClass('main')){ mainInit(); } });//end ready $(window).resize(function(){ sw = $(window).width(); sh = $(window).height(); if($('#wrap').hasClass('main')){ quickResize(); } });//end resize $(window).scroll(function() { offy = $(window).scrollTop(); if($('#wrap').hasClass('sub')){ scrollSubPage(offy) }; });//end scroll /************************ @ 상단메뉴 ************************/ function gnb(){ Gtarget = $('.gnb_wrap'); G_h = $('.gnb_wrap').height(); //gnb 고유높이값 Gtarget.find('> ul > li a').bind('mouseenter focus click',function(){ snb_Flag(0); }); Gtarget.bind('mouseleave',function(){ snb_Flag(1); }); $('.otherMenu').find('a').focus(function(){ snb_Flag(1); }); Gtarget.find('> ul > li').bind('mouseenter mouseleave',function(event){ if(event.type=='mouseenter'){ if(!$(this).hasClass('current')){ $(this).addClass('current'); } }else{ if(!$(this).hasClass('actived')){ $(this).removeClass('current'); } } }); //메뉴 초기화 Gtarget.css({'height':70,'visibility':'visible'}); if($('body').hasClass('mobile')){ Gtarget.find('> ul > li > a').attr('href','javascript:;'); } } //서브메뉴 보이기 안보이기 function snb_Flag(n){ if(n==0){ //배경 $('p.snb_bg').stop().css('display','block').animate({'height':G_h-70},900,'easeOutExpo'); //snb Gtarget.stop().animate({'height':G_h},900,'easeOutExpo'); }else{ //배경 $('p.snb_bg').stop().animate({'height':0},900,'easeOutExpo',function(){$(this).css('display','none');}); //snb Gtarget.stop().animate({'height':70},900,'easeOutExpo'); } } /************************ @ 푸터 셀렉박스 ************************/ function selectFooter(){ var FToogle = false; var FT_dx = 0; var FT_speed = 900; var FT_ease = 'easeOutExpo'; var FT_arrow_xy = 'left top' FT_offy = $('#select_family').find('.select_list').height(); //셀렉터 리스트 고유값 Ftarget = $('#select_family'); //셀렉터 부모 FStarget = Ftarget.find('.select_list'); //셀렉터 리스트 FAtarget = Ftarget.find('.select_title'); //셀렉터 제목 Ftarget.find('.select_title').bind('click',function(){ FT_move.selectMove(); }); var FT_move = { selectMove:function(){ if(FToogle){ FT_dx = 0; FToogle = false; FT_arrow_xy = 'left top' }else{ FT_dx = FT_offy; FToogle = true; FT_arrow_xy = 'left bottom' } FAtarget.find('.arrow').css({'background-position':FT_arrow_xy}) FStarget.stop().css('display','block').animate({'height':FT_dx},FT_speed,FT_ease) }, selectInit:function(){ FStarget.css('height','0') } } Ftarget.bind('mouseleave',function(){ if(FToogle){FT_move.selectMove();}; }); FT_move.selectInit(); } /************************ @ 메인이미지 로케이션 메뉴 셀렉박스 ************************/ function selectTmenu(){ var MToogle = false; var MT_dx = 0; var MT_speed = 900; var MT_ease = 'easeOutExpo'; var MT_arrow_xy = 'left top' var MT_color = '#444444' MT_offy = $('#select_tnb').find('.select_list').height(); //셀렉터 리스트 고유값 MTarget = $('#select_tnb'); //셀렉터 부모 MStarget = MTarget.find('.select_list'); //셀렉터 리스트 MAtarget = MTarget.find('.select_title'); //셀렉터 제목 MTarget.find('.select_title').bind('click',function(){ MT_move.selectMove(); }); var MT_move = { selectMove:function(){ if(MToogle){ MT_dx = 0; MToogle = false; MT_arrow_xy = 'left top' MT_color = '#444444'; }else{ MT_dx = MT_offy; MToogle = true; MT_arrow_xy = 'left bottom' MT_color = '#a71a19'; } MAtarget.css('color',MT_color).find('.arrow').css({'background-position':MT_arrow_xy}) MStarget.stop().css('display','block').animate({'height':MT_dx},MT_speed,MT_ease) }, selectInit:function(){ MStarget.css('height','0') } } MTarget.bind('mouseleave',function(){ if(MToogle){MT_move.selectMove();}; }); MT_move.selectInit(); } /************************ @ 가로슬라이드 ************************/ function widthSlide(_t,_w,_h,_a,_page,_time){ var Starget = _t; //해당타겟 var Swidth = _w; //움직임 넓이 var Sheight = _h; //높이 var Salign = _a; //페이징 정렬 var StimeFlag = _time; var Stimer,cur,prev,len,time,Sdirection; var Action; cur = 0; prev = -1; len = Starget.find('.slide_big > div').length; time = 5000; // 움직임 설정 var Action={ ease:'easeOutExpo', speed:900, autoTimer:function(){ prev = cur; cur = (cur >= len-1)?0:cur = cur+1; Sdirection = 1; //widthSlideMove(Starget,cur,prev,Swidth,Sdirection); Action._start(); }, _start:function(){ var _dx = (Sdirection == 0)?Swidth:Swidth*-1; //방향 //큰이미지 정렬 Starget.find('.slide_big > div').each(function(){ if($(this).index() == cur){ $(this).stop().css({'left':_dx*-1,'opacity':0}).animate({'left':0,'opacity':1},this.speed,this.ease); }else if($(this).index() == prev){ $(this).stop().animate({'left':_dx,'opacity':0},this.speed,this.ease); }else{ $(this).css({'left':_dx*-1,'opacity':0}) } }); //페이징 정렬 if(_page){ Starget.find('.pagenation01 > li').each(function(){ if($(this).index() == cur){ $(this).addClass('actived'); }else{ $(this).removeClass('actived'); } }); } }, _reset:function(_index){ prev = cur; cur = _index; Action._start(); } } this.setMove = function(_index){ Action._reset(_index); } //pagenation event handler if(_page){ Starget.append("") var i; for(i=0;i") } Starget.find('.pagenation01').each(function(){ if(Salign == 1){ $(this).css('margin-left',$(this).width()/2*-1); } }); Starget.find('.pagenation01 > li').click(function(){ prev = cur; cur = $(this).index(); Action._start(); }); } //timer event handler if(StimeFlag){ Starget.bind('mouseleave mouseenter',function(event){ if(event.type == 'mouseenter'){ clearInterval(Stimer); }else{ Stimer = setInterval(Action.autoTimer,time); } }); Stimer = setInterval(Action.autoTimer,time); } // arrow event handler Starget.find('> a').click(function(){ prev = cur; if($(this).index() == 1){ //left cur = (cur == 0)?len-1:cur=cur-1; Sdirection = 0; }else{ //right cur = (cur >= len-1)?0:cur = cur+1; Sdirection = 1; } Action._start(); }); Action._start() if($('body').hasClass('mobile')){ Starget.swipe(function(direction){ if(direction == "left"){ prev = cur; cur = (cur == 0)?len-1:cur=cur-1; Sdirection = 1; Action._start(); }else if(direction == "right"){ prev = cur; cur = (cur >= len-1)?0:cur = cur+1; Sdirection = 0; Action._start(); } //alert(direction); }, { preventDefault: false, mouse: true, pen: true, distance: 50 }); } } /************************ @ 오퍼시티 슬라이드 ************************/ function opaSlide(_t,_a,_page,_time){ var Starget = _t; //해당타겟 var Salign = _a; //페이징 정렬 var StimeFlag = _time; var Stimer,cur,prev,len,time,Sdirection; var Action; cur = 0; len = Starget.find('.slide_big > div').length; time = 5000; //pagenation event handler if(_page){ Starget.append("") var i; for(i=0;i") } Starget.find('.pagenation01').each(function(){ if(Salign == 1){ $(this).css('margin-left',$(this).width()/2*-1); } }); Starget.find('.pagenation01 > li').click(function(){ prev = cur; cur = $(this).index(); Action._start(); }); } // 움직임 설정 var Action={ ease:'easeOutExpo', speed:1200, autoTimer:function(){ prev = cur; cur = (cur >= len-1)?0:cur = cur+1; Action._start(); }, _start:function(){ //큰이미지 정렬 Starget.find('.slide_big > div').each(function(){ if($(this).index() == cur){ $(this).stop().fadeTo(0, 0.01).delay(30).fadeTo(300, 1); }else{ $(this).stop().css('display','none'); } }); //페이징 정렬 if(_page){ Starget.find('.pagenation01 > li').each(function(){ if($(this).index() == cur){ $(this).addClass('actived'); }else{ $(this).removeClass('actived'); } }); } }, _reset:function(_index){ cur = _index; Action._start(); } } if($('body').hasClass('mobile')){ Starget.swipe(function(direction){ if(direction == "left"){ prev = cur; cur = (cur == 0)?len-1:cur=cur-1; Action._start(); }else if(direction == "right"){ prev = cur; cur = (cur >= len-1)?0:cur = cur+1; Action._start(); } //alert(direction); }, { preventDefault: false, mouse: true, pen: true, distance: 50 }); } //timer event handler if(StimeFlag){ Starget.bind('mouseleave mouseenter',function(event){ if(event.type == 'mouseenter'){ clearInterval(Stimer); }else{ Stimer = setInterval(Action.autoTimer,time); } }); Stimer = setInterval(Action.autoTimer,time); } Action._start() }