//soft_go_to_top function go_top(orix,oriy,desx,desy) { var Timer; if (document.body.scrollTop == 0) { var winHeight = document.documentElement.scrollTop; } else { var winHeight = document.body.scrollTop; } if(Timer) clearTimeout(Timer); startx = 0; starty = winHeight; if(!orix || orix < 0) orix = 0; if(!oriy || oriy < 0) oriy = 0; var speed = 15; if(!desx) desx = 0 + startx; if(!desy) desy = 0 + starty; desx += (orix - startx) / speed; if (desx < 0) desx = 0; desy += (oriy - starty) / speed; if (desy < 0) desy = 0; var posX = Math.ceil(desx); var posY = Math.ceil(desy); window.scrollTo(posX, posY); if((Math.floor(Math.abs(startx - orix)) < 1) && (Math.floor(Math.abs(starty - oriy)) < 1)){ clearTimeout(Timer); window.scroll(orix,oriy); }else if(posX != orix || posY != oriy){ Timer = setTimeout("go_top("+orix+","+oriy+","+desx+","+desy+")",10); }else{ clearTimeout(Timer); } } //contents_tab $(document).ready(function(){ $('#contents_tab ul li').click(function(){ var index = $(this).index(); $(this).addClass('on').siblings().removeClass('on'); $('#tab_contents>div').eq(index).show().siblings().hide(); return false; }); }); //div_height $(document).ready(function(){ $('#main_layout #visual, #main_layout #visual .slide_box .slick-slide').css('height', $(window).height() - 0 ); $(window).resize(function() { $('#main_layout #visual, #main_layout #visual .slide_box .slick-slide').css('height', $(window).height() - 0 ); }); }); //header_change_main jQuery("document").ready(function($){ var nav = $('.main_layout #header'); $(window).scroll(function () { if ($(this).scrollTop() > $(window).height() - $('.main_layout #header').height()) { nav.addClass("changed"); } else { nav.removeClass("changed"); } }); }); //header_change_sub $(document).ready(function () { $(window).scroll(function() { var sclTop = $(this).scrollTop(); if (sclTop > 260) { $('.sub_layout #header').addClass('changed'); } else {$('.sub_layout #header').removeClass('changed');} }); }) //scroll_down $(document).on('click', 'p.scroll_down', function(event){ event.preventDefault(); var viewportHeight = $(window).height(); $('html, body').animate({ scrollTop: viewportHeight, complete: function () { //Hide your button here } }, 1000, 'easeOutExpo'); }); //mobile_gnb $(document).ready(function(){ $("#mg_open").click(function(){ $("#whole").animate({left: "-200px",}, 300, 'easeOutExpo'); $("#gnb").animate({right: "0",}, 300, 'easeOutExpo'); $(".mg_control").animate({right: "200px",}, 300, 'easeOutExpo'); $("#mg_open").css("display", "none"); $("#mg_close").css("display", "inline-block"); }); }); $(document).ready(function(){ $("#mg_close").click(function(){ $("#whole").animate({left: "0",}, 300, 'easeOutExpo'); $("#gnb").animate({right: "-200px",}, 300, 'easeOutExpo'); $(".mg_control").animate({right: "0",}, 300, 'easeOutExpo'); $("#mg_open").css("display", "inline-block"); $("#mg_close").css("display", "none"); }); }); //snb $(function(){ //DOM ready $('#header #gnb>ul>li>ul>li.snb>a').click(function(){ $(this).parent().siblings().removeClass('active').find('ul').slideUp(300, 'easeOutExpo'); if($(this).parent().hasClass('active')){ $(this).next().slideUp(300, 'easeOutExpo'); $(this).parent().removeClass('active'); } else{ $(this).next().slideDown(300, 'easeOutExpo'); $(this).parent().addClass('active'); } return false; }); }); //float_height_same $(document).ready(function() { var equalize = function () { var disableOnMaxWidth = 0; // 767 for bootstrap var grouped = {}; var elements = $('*[data-same-height]'); elements.each(function () { var el = $(this); var id = el.attr('data-same-height'); if (!grouped[id]) { grouped[id] = []; } grouped[id].push(el); }); $.each(grouped, function (key) { var elements = $('*[data-same-height="' + key + '"]'); elements.css('height', ''); var winWidth = $(window).width(); if (winWidth <= disableOnMaxWidth) { return; } var maxHeight = 0; elements.each(function () { var eleq = $(this); maxHeight = Math.max(eleq.height(), maxHeight); }); elements.css('height', maxHeight + "px"); }); }; var timeout = null; $(window).resize(function () { if (timeout) { clearTimeout(timeout); timeout = null; } timeout = setTimeout(equalize, 0); }); equalize(); });