var ui = ui || {}; ui.page = ui.page || {}; ui.page.common = function () { this.init(); }; ui.page.common.prototype = { init: function () { this._assignElements(); this._attachEventHandlers(); this._fnMainVisualSlider(); this._fnResizeWindow(); this._ready(); }, _assignElements: function () { this.welDoc = $(document.body); this.welWin = $(window); }, _attachEventHandlers: function () { this.welDoc.on('click', 'a[href="#"]', $.proxy(this._onClickEventPrevent, this)); this.welDoc.on('mouseover', '.logo a', $.proxy(this._initLocalstorageData, this)); this.welDoc.on('mouseover', '._fnGnbMenu .depth1 > li > a', $.proxy(this._fnGnbMenuOpen, this)); this.welDoc.on('mouseleave', '.navi', $.proxy(this._fnGnbMenuClose, this)); // ¸ð¹ÙÀÏ Çܹö°Å ¸Þ´º this.welDoc.on('click', '._gnbMenuOpen', $.proxy(this._fnMobileMenuShow, this)); this.welDoc.on('click', '._gnbMenuClose', $.proxy(this._fnMobileMenuHide, this)); this.welDoc.on('click', '._accordianMenu > ul > li > a', $.proxy(this._accordianMenu, this)); this.welDoc.on('click', '.footer .menu li a', $.proxy(this._initLocalstorageData, this)); this.welDoc.on('click', '._dropDownPagination', $.proxy(this._dropDownPagination, this)); this.welDoc.on('click', '._fnSectionMoving', $.proxy(this._fnSectionMoving, this)); }, _initLocalstorageData: function(){ localStorage.clear(); }, _fnResizeWindow : function(){ $(window).on('resize', function(){ if($(window).width() > 1023 && $('.gnb').hasClass('open')){ $('.gnb').removeClass('open'); $('.header').css('height',''); $('body').css('overflow', ''); } }) }, _dropDownPagination:function(e){ var target = $(e.currentTarget); target.toggleClass('open') }, _onClickEventPrevent: function (event) { event.preventDefault(); }, _fnMobileMenuShow:function(){ $('.gnb').addClass('open'); $('.header').css('height','100%'); $('body').css('overflow', 'hidden'); }, _fnMobileMenuHide:function(){ $('.gnb').removeClass('open'); $('.header').css('height',''); $('body').css('overflow', ''); this._fnGnbMenuClose(); }, _accordianMenu:function(e){ var target = $(e.currentTarget); target.parent().addClass('on').siblings().removeClass('on') }, _fnGnbMenuOpen: function(e){ var gnbTimer; if(gnbTimer){clearTimeout(gnbTimer);} $('.gnb').addClass('over'); TweenMax.to( $('.gnb .navi'),0.5,{height:360,ease:Cubic.easeOut}); }, _fnGnbMenuClose: function(e){ var gnbTimer; if($(window).width() > 1023){ if(gnbTimer){clearTimeout(gnbTimer);} gnbTimer = setTimeout(function(){ $('.gnb').removeClass('over'); TweenMax.to( $('.gnb .navi'),0.3,{height:100+"%",ease:Cubic.easeOut,onComplete:function(){}}); }, 200); } }, _fnMainVisualSlider: function(){ if($('#main').length > 0){ var welMainVisualSlider = $('._mainVisualSlider'); // ¸ÞÀÎ ½½¶óÀ̵å À̹ÌÁö ·Îµù ¿Ï·á ÈÄ ½½¶óÀ̵å visible welMainVisualSlider.imagesLoaded().done( function( instance ) { welMainVisualSlider.addClass('loaded'); }) welMainVisualSlider.slick({ arrows: false, dots: true, infinite: true, speed: 500, fade: true, cssEase: 'linear', autoplay: true, pauseOnHover:false, pauseOnFocus:false, autoplaySpeed: 4000, appendDots: $('.slide_indicator .inner-contents') }); } }, _fnSectionMoving: function(event){ var target = $(event.currentTarget); var nFirstSectionHeight = $('.main_visual').outerHeight(); var nHeaderHeight = $('.header').outerHeight(); if(target.hasClass('up')){ $('html, body').animate({scrollTop:0}); } else { $('html, body').animate({scrollTop:nFirstSectionHeight}); } }, _ready: function () { console.log('a') } }; var uiCommon = new ui.page.common();