//기본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 < 1279){
$('body').removeClass('pc');
$('#wrap').removeClass('pc');
$('#wrap').addClass('mobile');
}else{
$('body').addClass('pc');
$('#wrap').addClass('pc');
$('#wrap').removeClass('mobile');
}
}).resize();
function resetHeight(){
$('#scroll_wrap').css('height', $(window).innerHeight());
}
window.addEventListener("resize", resetHeight);
resetHeight();
}
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(){
$('#allmenu .all_gnb_wrap .all_gnb .menu .sub_menu > li a').addClass('custom_mousemove small_h');
var $navStatus = 0;
$(document).on("click","header .hamburger_btn",function(){
if($navStatus == 0) {
$navStatus = 1;
$('body').stop().addClass('menu_open');
$("#allmenu").stop().fadeIn(500);
var ClassName = $('body').attr('class');
if(ClassName == ClassName) {
tl.staggerFromTo($("#allmenu .inner"),1, {opacity:0}, {opacity: 1, delay:0.2, ease: Power1.easeInOut});
}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');
$('#allmenu .dep1').on('click', function() {
$(this).addClass('act');
if($(this).attr('class') == 'dep1 act'){
$(this).parents('.menu').siblings().find('.sub_menu_wrap').stop(true).slideUp();
tl.staggerFromTo($("#allmenu .inner .all_gnb .sub_menu"), 0.5, {opacity:0,}, {opacity:1,delay:0.3, ease: Power1.easeInOut}, .1);
$(this).next().stop(true).slideDown();
}else{
$('#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().hide();
});
}
function menuJs(){
$("#nav>ul>li").mouseenter(function(){
var menuNum = $(this).index()+1;
if(menuNum === menuNum){
$('header').addClass('dark');
$('header h1.logo').addClass('dark');
$(".lnb").stop().hide().removeClass('on');
$(".lnb.sub"+menuNum+"").stop().show();
tl.staggerFromTo($(".lnb.sub"+menuNum+" .dep2"), 0.5, {opacity:0, x:'10px'}, {opacity: 1,x:'0%', delay:0.1, ease: Power1.easeInOut});
}else{
$(".lnb").stop().hide();
}
});
$("#nav").mouseleave(function(){
$(".lnb").stop().hide();
$('header').removeClass('dark');
//$('header').removeClass('fix_style');
//$('header h1.logo').removeClass('fix_style');
/*if($('header').hasClass('fix_style')){
$('header').removeClass('on');
}else{
$('header').removeClass('dark on');
}*/
});
}
$(function(){
tl = TweenMax;
startJs();
popup();
allMenuJs();
menuJs();
});
$(function(){
/* 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');
//언어선택 셀렉박스
$(document).on("click", ".language>button",function(){
$(this).parent(".language").toggleClass("open");
if($(this).parent(".language").hasClass("open")){
$(".language").find("ul.list").stop().slideDown(500);
}else{
$(".language").find("ul.list").stop().slideUp(300);
}
});
});