$(function(){ tl = TweenMax; startJs(); popup(); menuJs(); allMenuJs(); customCursor(); videpPop(); }); $(document).on('click', 'a[href="#none"]', function(e) { e.preventDefault(); }); /*$(document).on('click', '.submit_button', function() { console.log(11); }); */ //기본js function startJs(){ $('#wrap').addClass('ani'); setTimeout(function() { $('#wrap').addClass('init'); }, 1000); //tl.staggerFromTo($("body:not(.pc) header"), 1, {opacity: 0}, {opacity: 1, delay:0.3, ease: Power1.easeInOut}); tl.staggerFromTo($("h1.logo .item3"), 0.8, {opacity: 0, x: '25%'}, {opacity: 1, x: '0%',delay:0.3, ease: Power1.easeInOut}); tl.staggerFromTo($("h1.logo .item2"), 0.7, {opacity: 0, x: '0%'}, {opacity: 1, x: '0%',delay:0.8, ease: Power1.easeInOut}); tl.staggerFromTo($("h1.logo .item1"), 0.7, {opacity: 0}, {opacity: 1, delay:0.8, ease: Power1.easeInOut}); tl.staggerFromTo($("#wrap header .gnb.depth1 > li > a p span"), 0.6, {opacity: 0, y: '100%',rotation:'0.001deg'}, {opacity: 1, y: '0%', delay:0.9, ease: Power1.easeInOut}, .05); tl.staggerFromTo($("#wrap header .area_r"), 0.8, {opacity: 0, x: '-25px'}, {opacity: 1, x: '0%',delay:0.3, ease: Power1.easeInOut}, .02); tl.staggerFromTo($("#wrap .video_btn"), 0.8, {opacity: 0, x: '-25px'}, {opacity: 1, x: '0%',delay:0.3, ease: Power1.easeInOut}, .02); $(document).on('click', 'a[href="#none"]', function(e) {e.preventDefault()}); if($('html').is('.ie67, .ie7, .ie8, .ie9')) { $('div.ie_alert_text').show().html('현재 사이트는 IE9 미만의 하위브라우저를 지원하지 않습니다.
브라우저를 최신 버전으로 업데이트해 주세요.'); } WebFont.load({google: {families: ['Noto Sans KR', 'Montserrat']}}); /* scroll */ var $animation_elements = $('.ani'); var $window = $(window); function check_if_in_view() { var window_height = $window.height(); var window_top_position = $window.scrollTop(); var window_bottom_position = (window_top_position + window_height); $.each($animation_elements, function() { var $element = $(this); var element_height = $element.outerHeight(); var element_top_position = $element.offset().top+200; var element_bottom_position = (element_top_position + element_height); //console.log(element_top_position); //check to see if this current container is within viewport if ((element_bottom_position >= window_top_position) && (element_top_position <= window_bottom_position)) { $element.addClass('in-view'); } else { //$element.removeClass('in-view'); } }); } $window.on('scroll resize', check_if_in_view); $window.trigger('scroll'); //모바일구분 $(window).resize(function(){ windowWidth = $(window).width(); if(windowWidth < 1279){ $('body').removeClass('pc'); $('#wrap').removeClass('pc'); $('#wrap').addClass('mobile'); }else{ $('body').addClass('pc'); $('#wrap').addClass('pc'); $('#wrap').removeClass('mobile'); } }).resize(); } function customCursor(){ var $cursor_primary = $('#custom_cursor'); var $cursor_secondary = $('#custom_cursor_text'); var $circle = $cursor_primary.find('.custom_cursor_circle'); var $cursor_txt = $cursor_secondary.find('.custom_cursor_txt'); $('body').mousemove(function(e) { TweenMax.to($cursor_primary, 0.7, {x: e.clientX,y: e.clientY,ease: Power3.easeOut}); TweenMax.to($cursor_secondary, 0.8, {x: e.clientX,y: e.clientY,ease: Power3.easeOut}); }); $(".view_more a, .mix_h").mouseenter(function () { $("#custom_cursor").addClass("on"); $("#custom_cursor_text").addClass("on"); }); $(".view_more, .mix_h").mouseleave(function(){ $("#custom_cursor").removeClass("on"); $("#custom_cursor_text").removeClass("on"); }); $(".mix_h2").mouseenter(function () { $("#custom_cursor").addClass("on_type2"); $("#custom_cursor_text").addClass("on_type2"); }); $(".mix_h2").mouseleave(function(){ $("#custom_cursor").removeClass("on_type2"); $("#custom_cursor_text").removeClass("on_type2"); }); $(document).on('mouseenter', '.custom_mousemove', function(){ var $this = $(this); var words = ( $this.data('hover') != undefined ) ? $this.data('hover') : ''; var size = ( $this.data('size') != undefined ) ? $this.data('size') : '100%'; $(".view_more a, .mix_h").mouseenter(function () { $("#custom_cursor").addClass("on"); $("#custom_cursor_text").addClass("on"); }); $(".mix_h2").mouseenter(function () { $("#custom_cursor").addClass("on_type2"); $("#custom_cursor_text").addClass("on_type2"); }); if( $this.hasClass('drag') ){ $cursor_primary.addClass('drag'); $cursor_secondary.addClass('drag'); } $cursor_txt.find('> span').text( words ); TweenMax.killTweensOf($circle, $cursor_txt); TweenMax.to($circle, .3, {width: size,height: size,autoAlpha: 1,ease: Power0.easeNone}); TweenMax.to($cursor_txt, .3, {width: size,height: size,autoAlpha: 1,ease: Power0.easeNone}); }); $(document).on('mouseleave', '.custom_mousemove', function(){ var $this = $(this); if( $this.hasClass('drag') ){ $cursor_primary.removeClass('drag'); $cursor_secondary.removeClass('drag'); } $(".view_more, .mix_h").mouseleave(function(){ $("#custom_cursor").removeClass("on"); $("#custom_cursor_text").removeClass("on"); }); $(".mix_h2").mouseleave(function(){ $("#custom_cursor").removeClass("on_type2"); $("#custom_cursor_text").removeClass("on_type2"); }); TweenMax.killTweensOf($circle, $cursor_txt); TweenMax.to($circle, .2, {width: '0%',height: '0%',autoAlpha: 0,ease: Power0.easeNone}); TweenMax.to($cursor_txt, .2, {width: '0%',height: '0%',autoAlpha: 0,ease: Power0.easeNone}); }); $('.follow_btn').each(function(){ var $this = $(this); var $pointer = $this.find('.i'); var pointer_size = ( $this.data('size') != undefined ) ? $this.data('size') : parseInt($this.width()); var $pointer_extend = null; if( $this.find('.follow').length > 0 ) { $pointer_extend = $this.find('.follow'); } $this.on({ mouseenter: function(){ $this.bind('mousemove', function(e){ var center_x = $pointer.offset().left + $pointer.width()/10; var center_y = $pointer.offset().top + $pointer.height()/10; var tween_x = e.pageX - center_x; var tween_y = e.pageY - center_y; if( $pointer_extend != null ) { TweenMax.to($pointer_extend, .3, {x: tween_x / 5.0,y: tween_y /5.0,ease: Power3.easeOut}); } }); }, mouseleave: function(){ if( $pointer_extend != null ) { TweenMax.to($pointer_extend, .3, {x: 0,y: 0,ease: Power0.easeNone}); } $this.unbind('mousemove'); } }); }); } function menuJs(){ //언어선택 $(".util_list .language .title").click(function(){ $(this).parent(".language").toggleClass("open"); if($(this).parent(".language").hasClass("open")){ $(".util_list .language").find("ul").stop().slideDown(); }else{ $(".util_list .language").find("ul").stop().slideUp(); } }); $(".util_list .language ul").mouseleave(function(){ $(".util_list .language").removeClass("open"); $(this).stop().slideUp(300); }); //menuJs /*menu hover*/ $("#nav>ul>li").mouseenter(function(){ $(this).addClass("on"); }); $("#nav>ul>li").mouseleave(function(){ $("#nav>ul>li").removeClass("on"); }); $("#nav>ul").mouseenter(function(){ }); } function allMenuJs(){ var $navStatus = 0; $(document).on("click","#hamburger_btn",function(){ if($navStatus == 0) { $navStatus = 1; $("#allmenu").fadeIn(); $('body').stop().addClass('menu_open'); var ClassName = $('body').attr('class'); if(ClassName == ClassName) { tl.staggerFromTo($("#allmenu .bg_wrap .bg1"), 0.6, {height:'0%'}, {height: '100%', delay:0.1, ease: Power1.easeInOut}, .1); tl.staggerFromTo($("#allmenu .bg_wrap .bg2"), 0.6, {height:'0%'}, {height: '100%', delay:0.1, ease: Power1.easeInOut}, .1); tl.staggerFromTo($("#allmenu .inner"), 0.3, {opacity:0}, {opacity:1,delay:0.6, ease: Power1.easeInOut}, .1); }else{ $navStatus = 0; } } }); $(document).on("click","#allmenu .close",function(){ $navStatus = 0; $('body').stop().removeClass('menu_open'); tl.staggerFromTo($("#allmenu .bg_wrap .bg1"), 0.8, {height:'100%'}, {height: '0%', delay:0.1, ease: Power2.easeInOut}, .1); tl.staggerFromTo($("#allmenu .bg_wrap .bg2"), 0.8, {height:'100%'}, {height: '0%', delay:0.1, ease: Power2.easeInOut}, .1); tl.staggerFromTo($("#allmenu .inner"), 0.6, {opacity:1}, {opacity:0,delay:0.1, ease: Power2.easeOut}, .1); setTimeout(function() { $("#allmenu").fadeOut(); }, 700); }); } function videpPop(){ $(".video_btn").click(function(){ var videoSrc = $(this).data("src"); $(".header_video_pop").show(); $("#bg").show(); }); $("#bg, .header_video_pop .close, .video_pop .close").click(function(){ $(".header_video_pop,.video_pop").hide(); $("#bg").hide(); $(".video_pop .video_g iframe").attr("src",""); var video = $("#pop_video")[0]; video.pause(); video.currentTime = 0; }); } function popup() { //레이어팝업 var bg = $("#bg"); $(document).on('click',' #bg, .close ', function () { bg.fadeOut(); $('div[id*="-popup"] div.inner').html(''); $('div[id*="-popup"]').hide(); }); $(document).on('click','.layer-', function () { var ClassName = $(this).data('link'); bg.show(); $('#layer-popup').show(); $('#layer-popup').html( ''+ '
'+ '
' ); //foot 메뉴 클릭시 switch (ClassName) { case "privacy1": $("#layer-popup div.inner").load("/_privacy1.php"); break; case "terms": $("#layer-popup div.inner").load("/_terms.php"); break; } }); //click }