$(function(){
tl = TweenMax;
startJs();
allMenuJs();
});
$(document).on('click', 'a[href="#none"]', function(e) {
e.preventDefault();
});
//기본js
function startJs(){
$("#wrap").addClass("start");
$(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']}});
//gambit scroll
var agent = navigator.userAgent.toLowerCase();
if ((navigator.appName == 'Netscape' && navigator.userAgent.search('Trident') != -1) || (agent.indexOf("msie") != -1)) {
//ie에서 휠
window.gambitScrollWheelAmount = 17;
} else {
//etc 휠
window.gambitScrollWheelAmount = 7;
}
/* 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');
}
function allMenuJs(){
/*$('body').niceScroll({
cursorcolor: "rgba(0,0,0,0.6)",
cursorwidth: 8,
scrollspeed: 70,
cursorborderradius: 0,
mousescrollstep: 60,
cursoropacitymin: 0,
cursoropacitymax: 1,
background: "#fff",
cursorborder: "none",
autohidemode: false,
boxzoom: false,
smoothscroll: true,
zindex:1001,
});*/
$('header #allmenu .inner').niceScroll({
cursorcolor: "rgba(0,0,0,0.6)",
cursorwidth: 0,
scrollspeed: 70,
cursorborderradius: 0,
mousescrollstep: 60,
cursoropacitymin: 0,
cursoropacitymax: 1,
background: "rgba(0,0,0,0.2)",
cursorborder: "none",
autohidemode: false,
boxzoom: false,
smoothscroll: true,
zindex:1001,
});
var allMenuItems = $("#allmenu .menu");
var allMenuDep1 = $("#allmenu .dep1");
var allMenuDep2 = $("#allmenu .dep2");
//모바일구분
$(window).resize(function(){
windowWidth = $(window).width();
if(windowWidth < 1279){
$("body").addClass("mobile");
}else{
$("body").removeClass("mobile");
skrollr.init();
}
}).resize();
$(document).on("click",".hamburger_btn.open",function(){
$(this).addClass("close");
$(this).removeClass("open");
$("#allmenu").fadeIn();
$("header").addClass("allmenuOpen");
$("body,html").addClass("fix");
});
$(document).on("click",".hamburger_btn.close",function(){
$(this).removeClass("close");
$(this).addClass("open");
$("#allmenu").fadeOut(300);
$("body,html").removeClass("fix");
$("header").removeClass("allmenuOpen");
$(window).resize(function(){
vw = $(window).width();
if(vw < 1262){
$("#allmenu .menu .box").slideUp();
}else{
}
}).resize();
});
/*태블릿모바일사이즈 전체메뉴*/
$(window).resize(function(){
vw = $(window).width();
if(vw < 1262){
$("#allmenu .menu .box").slideUp();
$("#allmenu .menu h2").removeClass("act");
}else{
$("#allmenu .menu .box").slideDown();
$("#allmenu .menu h2").removeClass("act");
}
}).resize();
$("#allmenu .menu h2").click(function(){
$(this).addClass("act");
if($(this).attr("class") == "dep1 act"){
$(this).next(".box").slideDown().addClass("on");
}else{
}
$(this).parents(".menu").siblings().find("h2").removeClass("act");
$(this).parents(".menu").siblings().find(".box").slideUp().removeClass("on");
});
}