$(function(){
startJS();
menuJS();
});
function startJS() {
$(document).on('click', 'a[href="#none"]', function(e) {e.preventDefault()});
WebFont.load({google: {families: ['Noto Sans KR', 'Montserrat']}});
if($('html').is('.ie67, .ie7, .ie8')) {
$('div.ie_alert_text').show().html('현재 사이트는 IE8 이하의 하위브라우저를 지원하지 않습니다.
브라우저를 최신 버전으로 업데이트해 주세요.');
}
(function inView() {
var $animation_elements = $('.a_');
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+100;
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');
}());
$('.foot_select_site h2').on('click', function(){
$('.foot_select_site ul.list').stop().slideToggle(450);
$(this).toggleClass('on');
});
$('header li.language > a').on('click', function(){
$('header .lang_l').slideToggle();
});
$(document).ready(function() {
$(window).on('scroll', function() {
if (300 < $(window).scrollTop()) {
$('#top_btn').fadeIn();
} else{
$('#top_btn').hide();
}
});
});
$('#top_btn').click(function() {
$('html, body').animate({
scrollTop: 0
}, 1500, 'easeOutExpo');
return false;
});
}
function menuJS () {
$('.all_country_btn').on('click', function(){
$(".m_country").stop(true).slideToggle();
});
$('.all_nav_btn.tm_br').on('click', function(){
$(this).find('.menu-trigger').stop(true).toggleClass('active');
$(".tm_menu").stop(true).slideToggle();
});
$('.main_nav li').on('click', function(){
var idx = $(this).index()+1;
var sectionTop = $('#sec'+idx).offset().top - 90;
$("html, body").stop(true).animate({
scrollTop: sectionTop
}, 1000, "easeOutQuint");
});
$('.open_nav li').on('click', function(){
var idx = $(this).index()+1;
var sectionTop = $('#sec'+idx).offset().top - 60;
$('.all_nav_btn.tm_br').find('.menu-trigger').stop(true).removeClass('active');
$(".tm_menu").stop(true).slideUp(200);
$("html, body").stop(true).animate({
scrollTop: sectionTop
}, 1000, "easeOutQuint");
});
}