$(function() {
if(!$("body").hasClass('main')) {
$("#logo a img").attr('src','../img/logo_color.png');
}
if($(window).width() < 1007) {
if($("body").hasClass('main')) {
$("#logo a img").attr('src','./img/logo_color.png');
} else {
$("#logo a img").attr('src','../img/logo_color.png');
}
}
$("#header .header_utils ul > li.list_item").mouseenter(function() {
$(this).addClass('on');
$(this).find('ul.sub').css({display:'block'});
}).mouseleave(function() {
$(this).removeClass('on');
$(this).find('ul.sub').css({display:'none'});
});
$("#header .header_utils ul > li > ul.sub > li").mouseenter(function() {
$(this).find('span').css({display:'block', width:'100%', opacity:'0'});
$(this).find('span').stop(true,true).animate({width:'100px', opacity:1}, 150);
}).mouseleave(function() {
$(this).find('span').css({display:'none'});
$(this).find('span').css({width:'100%', opacity:0});
});
$("#lnb > ul > li").mouseenter(function() {
$("#lnb .sub").css({display:'none'});
$("#lnb > ul > li").removeClass('on');
$(this).addClass('on');
$(this).find('ul.sub').css({display:'block'});
});
$("#header_wrap").mouseleave(function() {
$("#lnb .sub").css({display:'none'});
$("#lnb > ul > li").removeClass('on');
});
$("#lnb > ul > li > ul.sub > li").mouseenter(function() {
var pos = $(this).offset().left - $("#lnb").offset().left;
var size = $(this).width();
$(".lnb_line").stop(true,true).animate({left:pos + 'px', width:size + 'px', opacity:'1'}, 400);
}).mouseleave(function() {
$(".lnb_line").stop(true,true).animate({opacity:'0'},400);
});
$("#call_menu, #open_sitemap").click(function() {
var closebtn;
if($("body").hasClass('main')) {
closebtn = "
"
} else {
closebtn = "
"
}
if(!$("#header_sitemap").is(':visible')) {
$("#scrollTo").css({display:'none'});
if($("body").hasClass('main')) {
$("#header_wrap").addClass('sitemap');
}
$("#header_sitemap").css({display:'block'});
if($(window).width() > 1024) { $("body").css({'overflow-y':'hidden'}); }
$("#header_sitemap .inner").append(closebtn);
$("#header_sitemap .inner .btn_close").delay(200).animate({right:'50px', opacity:'1', rotate:'-180deg'}, 600, 'easeOutCubic');
} else {
sitemap_close();
}
});
function sitemap_close() {
$("#header_wrap").removeClass('sitemap');
$("#header_sitemap").css({display:'none'});
$("#header_sitemap .inner .btn_close").remove();
if($(window).width() > 1024) { $("body").css({'overflow-y':'auto'}); }
$("#scrollTo").css({display:'block'});
}
$(document).on('mouseenter', '#header_sitemap .inner .btn_close', function() {
$(this).filter(':not(:animated)').stop(true,false).animate({rotate:'0deg'}, 300, 'easeInCubic');
});
$(document).on('mouseleave', '#header_sitemap .inner .btn_close', function() {
$(this).stop(true,false).animate({rotate:'-180deg'}, 300, 'easeOutCubic');
});
$(document).on('click', '#header_sitemap .inner .btn_close', function() {
sitemap_close();
});
$("#header .header_sitemap .inner > ul > li > h2 > a").click(function() {
if($(window).width() <= 1024)
var winSize = $(window).width();
$("#header .header_sitemap .inner > ul > li > h2 > a").removeClass('on');
$("#header .header_sitemap .inner > ul > li > ul").css({display:'none'});
$(this).addClass('on');
$(this).parent().next('ul').css({width:winSize + 'px', display:'block'});
});
$("#header .header_sitemap .inner > ul > li > ul.depth1 > li > h3 > a").click(function(e) {
if($(window).width() <= 1024) {
if($(this).find('.more').length > 0) {
e.preventDefault();
if($(this).find('.more').hasClass('active')) {
$(this).find('.more').removeClass('active');
$(this).parents('h3').nextAll('ul').stop(true,false).slideUp(200);
} else {
$(this).find('.more').addClass('active');
$(this).parents('h3').nextAll('ul').stop(true,false).slideDown(200);
}
}
}
});
$("#header_wrap .header_tit_bar .more a").click(function() {
if($("#header_wrap .header_tit_bar .menu_list").is(':visible')) {
$(this).parents('.bar').next('.menu_list').css({display:'none'});
} else {
$(this).parents('.bar').next('.menu_list').css({display:'block'});
}
});
$("#nav_scroll ul li.dropdown").mouseenter(function() {
$(this).find('ul.dropdown_list').css({display:'block'});
}).mouseleave(function() {
$(this).find('ul.dropdown_list').css({display:'none'});
});
$("#playClip").click(function() {
var vSource = '';
$("#videoClose").css({display:'block'});
$("#videoClose").animate({left:'-50px', rotate:'-360deg'}, 200);
$("#videoClip").html(vSource);
$("#videoClip").css({display:'block'});
});
$("#videoClose").mouseenter(function() {
$(this).find('img').attr('src','./img/video_close_on.png');
$(this).find('img').stop(true,false).animate({scale:'1.1'}, 150, function() {
$(this).stop(true,false).animate({scale:'1'}, 150);
});
}).mouseleave(function() {
$(this).find('img').attr('src','./img/video_close.png');
}).click(function() {
$(this).animate({left:'20px', rotate:'0'}, 200, function() {
$(this).css({display:'none'});
});
$("#videoClip").css({display:'none'});
$("#videoClip").html('');
});
$("#scrollTo").click(function(){
$("html, body").animate({scrollTop:0}, 500);
});
$("#footer .right_con .dropdown > li > a").click(function() {
var target = $(this).next('ul');
if(target.css('display')==='block') {
target.css({display:'none'});
} else {
target.css({display:'block'});
}
});
if($("#imgPopup").length > 0) {
var pop_w = ($(window).width() - $("#imgPopup").width()) / 2;
var pop_h = ($(window).height() - $("#imgPopup").height()) / 2;
$("#imgPopup").css({left:pop_w + 'px', top:pop_h + 'px'});
}
});
$(function() {
$("#container .aside ul > li > h3 > a, #container .aside ul > li > ul > li > h4 > a").click(function() {
if(!$(this).hasClass('on')) {
$(this).addClass('on');
$(this).parent().nextAll('ul').stop(true,false).slideDown(200);
} else {
$(this).removeClass('on');
$(this).parent().nextAll('ul').stop(true,false).slideUp(200);
}
});
});
$(function() {
function textEffect() {
$("ul.text_effect p .color1").stop(true,false).animate({width:'100%'}, 1000, 'easeInOutCubic', function() {
$("ul.text_effect p .color2").stop(true,false).animate({width:'100%'}, 1000, function() {
$("ul.text_effect p .color1").css({width:0});
$("ul.text_effect p .color2").css({width:0});
textEffect();
});
});
}
if($("#sub_visual .visual_tit").length > 0) {
$("#sub_visual .visual_tit ul p").animate({left:'-200px', opacity:0});
$("#sub_visual .visual_tit ul").animate({left:'-200px', opacity:0}, 0, function() {
$("#sub_visual .visual_tit ul").animate({left:'0', opacity:1}, 800);
$("#sub_visual .visual_tit ul p").animate({left:'0', opacity:1}, 1000);
});
}
if($("ul.text_effect").length > 0) {
textEffect();
}
});
$(function() {
var photoIndex = 1;
var swipeIndex = 0;
if($("#photo_swipe").length > 0) {
var wSize = $("#photo_swipe").width();
var count = $("#photo_swipe ul li").length;
$("#photo_swipe ul").css({width:wSize * count + 'px'});
$("#photo_swipe ul li").css({width:wSize+'px'});
}
function slide_resize(img) {
var zh = 64;
var vh = (img.height() - zh) / 2;
img.find('.zoom').css({top:vh + 'px'});
}
function slide_init() {
var pcount = Math.ceil($("#photo_list li").length / 4);
var mcount = $("#photo_swipe ul li").length;
$("#container .section_con .photo_slide .paging span.all").text(pcount);
$("#container .section_con .photo_slide .paging_m span.all").text(mcount);
}
function photo_slide() {
var count = Math.ceil($("#photo_list li").length / 4);
var mcount = $("#photo_swipe ul li").length;
var imgSize = $("#photo_swipe ul li:first").width();
if(photoIndex<1) {
photoIndex = 1;
} else if(photoIndex>count) {
photoIndex = count;
} else {
$("#photo_list li").css({display:'none'});
$("#photo_list li.page" + photoIndex).css({display:'block'});
$("#container .section_con .photo_slide .paging span.current").text(photoIndex);
}
}
function swipe_left() {
var imgSize = $("#photo_swipe ul li:first").width();
var mcount = $("#photo_swipe ul li").length;
if(swipeIndex<0) {
swipeIndex = mcount - 1;
}
$("#photo_swipe ul").css({left:-imgSize+'px'});
$("#photo_swipe ul li:first").before($("#photo_swipe ul li:last"));
$("#photo_swipe ul").stop(true,false).animate({left:0}, 300, 'easeOutCubic', function() {
$("#container .section_con .photo_slide .paging_m span.current").text(swipeIndex+1);
});
}
function swipe_right() {
var imgSize = $("#photo_swipe ul li:first").width();
var mcount = $("#photo_swipe ul li").length;
if(swipeIndex>=mcount) {
swipeIndex = 0;
}
$("#photo_swipe ul").stop(true,false).animate({left:-(imgSize) + 'px'}, 300, 'easeOutCubic', function() {
$("#photo_swipe ul li:last").after($("#photo_swipe ul li:first"));
$("#photo_swipe ul").css({left:0});
$("#container .section_con .photo_slide .paging_m span.current").text(swipeIndex+1);
});
}
$("#photo_prev").click(function() {
photoIndex--;
photo_slide();
});
$("#photo_next").click(function() {
photoIndex++;
photo_slide();
});
$("#photo_prev_m").click(function() {
swipeIndex--;
swipe_left();
});
$("#photo_next_m").click(function() {
swipeIndex++;
swipe_right();
});
if($("#photo_swipe").length > 0) {
$("#photo_swipe").swipe({
swipe:function(event, direction, distance, duration, fingerCount, fingerData) {
if(direction == "left"){
swipeIndex++;
swipe_right();
} else if(direction == "right"){
swipeIndex--;
swipe_left();
threshold:0
}
}
});
}
$("#photo_list li").mouseenter(function() {
$(this).find('a').css({display:'block'});
slide_resize($(this));
}).mouseleave(function() {
$(this).find('a').css({display:'none'});
});
slide_init();
});
$(function() {
var popIndex = 0;
var popCount = $("#imgPopup .img_wrap ul li").length;
function popImgFade() {
if(popIndex < 0) {
popIndex = popCount - 1;
} else if(popIndex >= popCount) {
popIndex = 0;
}
var imgTitle = $("#imgPopup .img_wrap ul li").eq(popIndex).find('img').attr('alt');
console.log(popIndex);
$("#imgPopup .img_wrap ul li").removeClass('on');
$("#imgPopup .img_wrap ul li").eq(popIndex).css({opacity:0});
$("#imgPopup .img_wrap ul li").stop(true,true).eq(popIndex).animate({opacity:1}, 500, 'easeOutCubic');
$("#imgPopup .img_wrap ul li").eq(popIndex).addClass('on');
$("#imgPopup p.tit").text(imgTitle);
}
$("#img_popup_wrap .pop_prev").click(function() {
popIndex--;
popImgFade();
});
$("#img_popup_wrap .pop_next").click(function() {
popIndex++;
popImgFade();
});
$("#img_popup_wrap .pop_close").click(function() {
$("#img_popup_wrap").css({visibility:'hidden'});
});
$("#photo_list li").click(function() {
var idx = $(this).index();
var pop_w = ($(window).width() - $("#imgPopup").width()) / 2;
var pop_h = ($(window).height() - $("#imgPopup").height()) / 2;
popIndex = idx;
$("#img_popup_wrap").css({display:'block', visibility:'visible'});
$("#imgPopup").css({left:pop_w + 'px', top:pop_h + 'px'});
popImgFade();
});
});
$(window).scroll(function() {
if($(window).scrollTop() > 100) {
$("#scrollTo").css({display:'block'});
if($("body").hasClass('main')) {
$("#header_wrap").stop(true,false).fadeOut(200);
}
if(!$("#nav_scroll").hasClass('active')) {
$("#nav_scroll").addClass('active');
$("#nav_scroll").css({top:'-42px'});
$("#nav_scroll").animate({top:'0'}, 500);
if($("body").hasClass('main')) {
$("#nav_scroll ul li.home a img").attr('src', './img/nav_logo.png');
} else {
$("#nav_scroll ul li.home a img").attr('src', '../img/nav_logo.png');
}
}
} else {
if(!$("body").hasClass('main')) { $("#nav_scroll ul li.home a img").attr('src', '../img/nav_logo_cl.png'); }
$("#nav_scroll").css({top:'111px'});
$("#nav_scroll").removeAttr('style').removeClass('active');
$("#header_wrap").stop(true,false).fadeIn(200);
$("#scrollTo").css({display:'none'});
}
});
$(window).resize(function() {
if($(this).width() < 1007) {
if($("body").hasClass('main')) {
$("#logo a img").attr('src','./img/logo_color.png');
} else {
$("#logo a img").attr('src','../img/logo_color.png');
}
} else {
if($("body").hasClass('main')) {
$("#logo a img").attr('src','./img/logo.png');
}
}
if($(this).width() < 1025) { $("#header .header_sitemap .inner > ul > li > ul").css({width:$(this).width() + 'px'}); }
if($("#photo_swipe").length > 0) {
var wSize = $("#photo_swipe").width();
var count = $("#photo_swipe ul li").length;
$("#photo_swipe ul").css({width:wSize * count + 'px', left:0});
$("#photo_swipe ul li").css({width:wSize + 'px'});
}
if($("#imgPopup").length > 0) {
var pop_w = ($(window).width() - $("#imgPopup").width()) / 2;
var pop_h = ($(window).height() - $("#imgPopup").height()) / 2;
$("#imgPopup").css({left:pop_w + 'px', top:pop_h + 'px'});
}
});
$(window).load(function() {
if($("#sub_visual").length > 0) {
$("#sub_visual img").addClass('load');
}
});
$(function() {
if($(".brd_photo_list").length > 0) {
$(".brd_photo_list > table:last").remove();
for(i=0; i<3; i++) {
$(".brd_photo_list").append('');
}
}
});
// 메뉴 관련 스크립트
$(function() {
// 메뉴 호출버튼 클릭시
$("#gnbOpen").bind('click touchstart', function() {
if(!$("#gnbMask").is(':visible')) {
openNav();
}
});
$("#open_sitemap").bind('click touchstart', function() {
if(!$("#gnbMask").is(':visible')) {
openNav2();
}
});
// 메뉴 닫기버튼 클릭시
$("#gnbClose").bind('click touchstart', function() {
closeNav();
});
// 메뉴 닫기버튼 클릭시
$("#gnbClose").bind('click touchstart', function() {
closeNav2();
});
// 메뉴 클릭시
$("#gnb > ul > li > a").bind('click touchstart', function(e) {
var $submnu = $(this).siblings('ul');
if($submnu.length > 0) {
e.preventDefault();
$("#gnb > ul > li > ul.submnu").css('display','none');
$submnu.css({display:'block', left:'100%'});
$submnu.stop(true,false).animate({left:'-20px'}, 500, 'easeOutCubic', function() {
setMnuHeight('animate');
$submnu.stop(true,false).animate({left:'20px'}, 100, function() {
$submnu.stop(true,false).animate({left:0}, 100);
});
});
}
});
// 전체메뉴 열기
function openNav() {
$("#gnbOpen").addClass('open');
$("#gnbOpen").stop(true,false).delay(300).animate({opacity:'0'}, 300);
$("body").css('overflow-x','hidden');
$("#gnb ul").css({left:'100%'});
$("#navigation").stop(true,false).fadeIn(300, function() {
$("#gnb > ul").stop(true,false).animate({left:'-20px'}, 500, 'easeOutCubic', function() {
$("#gnb > ul").stop(true,false).animate({left:'20px'}, 100, function() {
$("#gnb > ul").stop(true,false).animate({left:'0'}, 100, function() {
$("body").removeAttr('style');
});
});
});
});
$("#gnbClose").stop(true,false).delay(400).fadeIn(300);
setMnuHeight();
}
function openNav2() {
$("#gnbOpen").addClass('open');
$("#gnbOpen").stop(true,false).delay(300).animate({opacity:'0'}, 300);
$("body").css('overflow-x','hidden');
$("#gnb ul").css({left:'100%'});
$("#navigation").stop(true,false).fadeIn(300, function() {
$("#gnb > ul").stop(true,false).animate({left:'-20px'}, 500, 'easeOutCubic', function() {
$("#gnb > ul").stop(true,false).animate({left:'20px'}, 100, function() {
$("#gnb > ul").stop(true,false).animate({left:'0'}, 100, function() {
$("body").removeAttr('style');
});
});
});
});
$("#gnbClose").stop(true,false).delay(400).fadeIn(300);
setMnuHeight();
}
// 전체메뉴 닫기
function closeNav2() {
$("#gnbOpen").removeClass('open');
$("#navigation").stop(true,false).fadeOut(300, function() {
$("#gnbClose").css('display','none');
$("#gnbOpen").stop(true,false).animate({opacity:'1'}, 300);
subMnuClose();
});
}
// 전체메뉴 닫기
function closeNav() {
$("#gnbOpen").removeClass('open');
$("#navigation").stop(true,false).fadeOut(300, function() {
$("#gnbClose").css('display','none');
$("#gnbOpen").stop(true,false).animate({opacity:'1'}, 300);
subMnuClose();
});
}
// 전체메뉴 하위메뉴 숨기기
function subMnuClose() {
$("#gnb > ul > li > ul.submnu").css('display','none');
}
// 전체메뉴 세로 위치값 조절
function setMnuHeight(option) {
var wHeight = $(window).height();
var mnuHeight = $("#nav_wrap").height();
if(option==='animate') {
$("#nav_wrap").stop(true,false).animate({top:(wHeight - mnuHeight + 60) / 2 + 'px'}, 300);
} else {
$("#nav_wrap").css('top',(wHeight - mnuHeight + 60) / 2 + 'px');
}
}
});