$(document).on('click', 'a[href="#none"]', function(e) {
e.preventDefault();
});
//기본js
function startJs(){
$(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']}});
//모바일구분
$(window).resize(function(){
windowWidth = $(window).width();
if(windowWidth <= 767){
//m
$('#wrap').removeClass('pc');
$('body').removeClass('pc');
$('body').addClass('tm');
$('body').removeClass('t');
$('body').addClass('m');
}else if($(window).width() <= 1279){
//tablet
$('#wrap').removeClass('pc');
$('body').removeClass('pc');
$('body').addClass('tm');
$('body').addClass('t');
$('body').removeClass('m');
}else{
//pc
$('#wrap').addClass('pc');
$('body').addClass('pc');
$('body').removeClass('tm');
$('body').removeClass('t');
$('body').removeClass('m');
}
}).resize();
/*
tl.staggerFromTo($("body.tm #wrap"), 1, {opacity:0}, {opacity: 1, ease: Power1.easeInOut});*/
}
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
}
function allMenuJs(){
var $navStatus = 0;
$(document).on("click","header .hamburger_btn",function(){
if($navStatus == 0) {
$navStatus = 1;
$('body').stop().addClass('menu_open');
$("#allmenu").stop().fadeIn(200);
var ClassName = $('body').attr('class');
if(ClassName == ClassName) {
tl.staggerFromTo($("#allmenu .all_gnb_wrap .all_gnb"), 0.6, {opacity:0}, {opacity: 1, ease: Power1.easeInOut});
tl.staggerFromTo($("#allmenu .info_wrap .info_list .list"), 0.6, {opacity:0,y:'30px'}, {opacity: 1,y:'0%', ease: Power1.easeInOut},0.1);
tl.staggerFromTo($("#allmenu .channels_list li"), 0.6, {opacity:0,y:'30px'}, {opacity: 1,y:'0%', delay:0.5, ease: Power1.easeInOut},0.1);
}else{
$navStatus = 0;
}
}
//태블릿,모바일 아코디언 allmenu
$(window).on('resize', function() {
var windowSize = $(window).width();
if(windowSize <= 1279) {
//init
$('#allmenu .sub_menu_wrap').hide();
$('#allmenu .dep1').removeClass('act');
} else {
//init
$('#allmenu .dep1').removeClass('act');
$('#allmenu .sub_menu_wrap').show();
}
}).resize();
});
$(document).on("click","#allmenu .close",function(){
$navStatus = 0;
$('body').stop().removeClass('menu_open');
$("#allmenu").stop().fadeOut(200);
});
$(document).on("click","#allmenu .dep1",function(){
$(this).toggleClass('act');
if($(this).hasClass('act')){
$('#allmenu .dep1').removeClass('act');
$(this).addClass('act');
$(this).parents('.menu').siblings().find('.sub_menu_wrap').stop(true).slideUp();
$(this).next().stop(true).slideDown();
}else{
$('#allmenu .dep1').removeClass('act');
$(this).next().stop(true).slideUp();
}
});
}
function menuJs(){
/*menu hover*/
$("#nav>ul>li").mouseenter(function(){
var menuNum = $(this).index()+1;
if(menuNum === menuNum){
$("#nav>ul>li").removeClass("on");
$(this).addClass("on");
$("body:not(.dark) header").addClass('on');
$(this).find(".lnb").stop().slideDown();
$(this).siblings().find('.lnb').stop(true).hide();
tl.staggerFromTo($("#wrap header #nav .on .lnb .menu_head"), 0.6, {opacity:0,y: '20px'}, {opacity:1,y:'0px', ease: Power1.easeInOut});
tl.staggerFromTo($("#wrap header #nav .on .lnb ul"), 0.6, {opacity:0,x: '20px'}, {opacity:1,x:'0px', ease: Power1.easeInOut},0.1);
}else{
}
});
$("#nav").mouseleave(function(){
$("body:not(.dark) header").removeClass('on');
$(".lnb").stop().hide();
$(".lnb > ul").stop().hide();
$('header .gnb > li.on').removeClass('on');
});
//footer family site
$("#family_site .btn").click(function(){
$("#family_site ul").slideToggle();
});
}
function custom_cursor(){
var $cursor_primary = $('#custom_cursor');
var $circle = $cursor_primary.find('.custom_cursor_circle');
$('body').mousemove(function(e) {
tl.to($cursor_primary, 0.7, {opacity:1, x: e.clientX,y: e.clientY,ease: Power3.easeOut});
});
$(document).on('mouseenter', '.custom_mousemove', function(){
$(this).addClass('move_on');
var $this = $(this);
var words = ( $this.data('hover') != undefined ) ? $this.data('hover') : '';
var size = ( $this.data('size') != undefined ) ? $this.data('size') : '100%';
if( $this.hasClass('small_h') ){
$cursor_primary.addClass('small');
}else{
$cursor_primary.removeClass('small');
}
tl.killTweensOf($circle);
tl.to($circle, .3, {width: size,height: size,autoAlpha: 1,ease: Power0.easeNone});
});
$(document).on('mouseleave', '.custom_mousemove', function(){
var $this = $(this);
tl.killTweensOf($circle);
tl.to($circle, .2, {width: '20px',height: '20px',ease: Power0.easeNone});
$(this).removeClass('move_on');
});
$('.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 ) {
tl.to($pointer_extend, .3, {x: tween_x / 5.0,y: tween_y /5.0,ease: Power3.easeOut});
}
});
},
mouseleave: function(){
if( $pointer_extend != null ) {
tl.to($pointer_extend, .2, {x: 0,y: 0,ease: Power0.easeNone});
}
$this.unbind('mousemove');
}
});
});
}
$(function(){
startJs();
popup();
menuJs();
//custom_cursor();
allMenuJs();
tl = TweenMax;
});