var ROLLING=typeof ROLLING==="undefined"?{}:console.log("."); ROLLING = { //Default. _minW:1024, //Initialize. init:function(){ this.reset(); this.resizeInit(); this.header.init(); this.overview.init(); window.scrollTo(0, 0); }, reset:function(){ if(Browser.ie8 || Browser.ie7){ $('body').addClass('ie'); } }, //Resize. resize:function(){ this.ww = Util._w(); this.ww = (this._minW > this.ww)? this._minW:this.ww; }, resizeInit:function(){ var h = this; $(window).bind('resize.rolling',function(){ h.resize(); }); if(window.onorientationchange!==undefined) { $(window).bind('orientationchange.rolling', function() { h.resize(); }); } $(window).trigger('resize.rolling'); }, resizeRemoveInit:function(){ $(window).unbind('resize.rolling'); if(window.onorientationchange!==undefined){ $(window).unbind('orientationchange.rolling'); } } }; ROLLING.header = { //Default. _active:50, //Initialize. init:function(){ this.layout(); this.reset(); this.resetInit(); }, layout:function(){ this.$header = $('#header'); this.$gnb = $('#gnb'); this.$gnbList = this.$gnb.find('.menu'); this.$gnbEl = this.$gnbList.find('.btn_menu'); this.$gnbListActive = this.$gnb.find('li.active'); this.$gnbMenuActiveContainer = this.$gnbListActive.find('.gnb_depth>ul'); this.$gnbMenuSelectEl = this.$gnbMenuActiveContainer.find('a.select'); this.$gnbMenuActiveContainer = this.$gnbListActive.find('.gnb_depth>ul'); this.$gnbMenuActiveContainer = this.$gnbListActive.find('.gnb_depth>ul'); }, reset:function(){ this.activeHeight = 0; if(MENU_ID == "business"){ if(LNB_ID != ""){ this.activeHeight = 53; }else{ this.activeHeight = 30; } }else{ this.activeHeight = 30; } if(MENU_ID == "business"){ if(GNB_ID == "publication"){ this.activeTop = 254; }else if(GNB_ID == "bridge"){ this.activeTop = 177; }else if(GNB_ID == "community"){ this.activeTop = 100; }else if(GNB_ID == "education"){ this.activeTop = 0; } }else{ this.activeTop = 31*this.$gnbMenuSelectEl.parent('li').index(); } this.$gnbMenuActiveContainer.css({'top':this.activeTop*-1}); }, //Event. resetInit:function(){ $(window).bind('scroll.header', this.onScroll); this.$gnbEl.bind('mouseenter.header', this.onOver); this.$gnbList.bind('mouseleave.header', this.onOut); }, removeInit:function(){ $(window).unbind('scroll.header'); this.$gnbEl.unbind('mouseenter.header'); this.$gnbList.unbind('mouseleave.header'); }, //Event Function. onScroll:function(){ var h = ROLLING.header, p = Util._scrollPosition(); if(p >= h._active){ h.$header.addClass('active'); }else{ h.$header.removeClass('active'); } }, onOver:function(){ var h = ROLLING.header, list = $(this).parent('li'), id = list.attr('id').replace('menu_',''), menu = list.find('.gnb_depth'), menuContainer = list.find('.gnb_depth>ul'), menuHeight = menuContainer.height(), d; if(id == "business"){ menu.find('li.active').removeClass('active'); menuHeight = 284; } d = (id == "business")? 0.2:0.14; TweenLite.to(menu, d, {css:{height:menuHeight}, ease:Quad.easeIn}); TweenLite.to(menuContainer, d, {css:{top:0}, ease:Quad.easeIn}); }, onOut:function(){ var h = ROLLING.header, list = $(this), id = this.id.replace('menu_',''), menu = list.find('.gnb_depth'), menuContainer = list.find('.gnb_depth>ul'), menuHeight, menuTop, d; menuHeight = (id == MENU_ID)? h.activeHeight:0; menuTop = (id == MENU_ID)? h.activeTop:0; if(id == "business") $("#business_"+GNB_ID).parent('li').addClass('active'); d = (id == "business")? 0.2:0.14; TweenLite.to(menu, d, {css:{height:menuHeight}, ease:Quad.easeOut}); TweenLite.to(menuContainer, d, {css:{top:menuTop*-1}, ease:Quad.easeOut}); } }; ROLLING.overview = { //Default. _originW:1600, _originH:420, //Initialize. init:function(){ this.layout(); this.resizeInit(); }, layout:function(){ this.$overview = $('#overview'); if(this.$overview.length>0) this.$overviewBG = this.$overview.find('.overview_bg'); }, //Resize. resize:function(){ var h = ROLLING.overview, bgW = (ROLLING.ww > h._originW)? ROLLING.ww:h._originW, bgH = Math.round(h._originH*bgW/h._originW); if(this.$overview.length>0){ this.$overviewBG.css({width:bgW, height:bgH, marginTop:Math.round(bgH/2)*-1, marginLeft:Math.round(bgW/2)*-1}); } }, resizeInit:function(){ var h = this; $(window).bind('resize.overview',function(){ h.resize(); }); if(window.onorientationchange!==undefined) { $(window).bind('orientationchange.overview', function() { h.resize(); }); } $(window).trigger('resize.overview'); }, resizeRemoveInit:function(){ $(window).unbind('resize.banner'); if(window.onorientationchange!==undefined){ $(window).unbind('orientationchange.overview'); } } }; $(document).ready(function(){ ROLLING.init(); });