$(function() {
var tpl = $("#header").data('temp');
// ¸ð¹ÙÀÏ/ÅÂºí¸´/PC üũ ÇÔ¼ö
function isPC() {
var wSize = $(window).width();
if(wSize > 1024) {
return true;
} else {
return false;
}
}
// IE üũ
function ifIE() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
return true;
} else {
return false;
}
return false;
}
if(ifIE()===true) {
if($("body").hasClass('main')) {
$("head").append('');
} else {
$("head").append('');
}
}
// body ½ºÅ©·Ñ ¹æÁö ÇÔ¼ö
function bodyLock() {
$("html").addClass('lock');
}
// body ½ºÅ©·Ñ ¹æÁö ÇØÁ¦ ÇÔ¼ö
function bodyUnlock() {
$("html").removeClass('lock');
}
// LNB ¸¶¿ì½º ¾×¼Ç
$("#lnb > li").mouseenter(function() {
$("#lnb > li").removeClass('on');
$(this).addClass('on');
if($(this).find('ul.depth2').length > 0) {
if(isPC()===true) {
$(this).find('ul.depth2').stop(true,false).fadeIn(200);
}
}
}).mouseleave(function() {
$("#lnb > li").removeClass('on');
if(isPC()===true) {
$(this).find('ul.depth2').stop(true,false).fadeOut(200);
}
}).click(function() {
if(isPC()===false) {
if($(this).find('ul.depth2').length > 0) {
if(!$(this).hasClass('open')) {
$("#lnb > li").removeClass('open');
$("#lnb > li > ul.depth2").css('display','none');
$(this).find('ul.depth2').css('display','block');
$(this).addClass('open');
} else {
$(this).removeClass('open');
$(this).find('ul.depth2').css('display','none');
}
}
} else {
if($(this).find('ul.depth2').length > 0) {
var sURL = $(this).find('ul.depth2 li:first a').attr('href');
location.href = sURL;
}
}
});
// ÅÂºí¸´ ÀÌÇÏ »çÀÌÁî ¸Þ´º Æîħ ¾Ö´Ï¸ÞÀ̼Ç
function mMenuOpen() {
var mnu = $("#lnb > li");
var num = 1;
$("#lnb > li > a").css({position:'relative', top:'-20px', left:'-20px'});
$.each($("#lnb > li > a"), function(i, el) {
$(el).css('opacity','0');
setTimeout(function() {
$(el).animate({top:0, left:0, opacity:'1'}, 500);
}, 0 + (i*50));
});
}
// ÅÂºí¸´ ÀÌÇÏ »çÀÌÁî ¸Þ´º ´Ý±â ¾Ö´Ï¸ÞÀ̼Ç
function mMenuClose() {
var mnu = $("#lnb > li");
var num = 1;
$.each($("#lnb > li > a").get().reverse(), function(i, el) {
setTimeout(function() {
$(el).animate({top:'-20px', left:'-20px', opacity:'0'}, 500);
}, 0 + (i*50));
});
}
// ÅÂºí¸´ ÀÌÇÏ »çÀÌÁî¿¡¼ ¸Þ´º È£Ãâ¹öÆ° Ŭ¸¯½Ã
$("#m_call").click(function() {
if(!$(this).hasClass('on')) {
$(this).addClass('on');
bodyLock();
scrollActive();
mMenuOpen();
$(".lnb_wrap").stop(true,false).slideDown(500);
} else {
bodyUnlock();
$(this).removeClass('on');
mMenuClose();
$(".lnb_wrap").stop(true,false).delay(100).slideUp(500);
}
});
// ¼ºêÆäÀÌÁö ·Î°í ó¸® ÇÔ¼ö
function subActive() {
if(!$("body").hasClass('main')) {
$("#header h1 img").attr('src',tpl + '/img/logo_0330_color.png');
} else {
$("#header h1 img").attr('src',tpl + '/img/logo_0210.png');
}
if(!$("body").hasClass('main') && $("body").hasClass('visual')) {
$("#header h1 img").attr('src',tpl + '/img/logo_0210.png');
} else if(!$("body").hasClass('main') && !$("body").hasClass('visual')) {
$("#header h1 img").attr('src',tpl + '/img/logo_0330_color.png');
}
}
// Çì´õ ½ºÅ©·Ñ È°¼ºÈ ÇÔ¼ö
function scrollActive() {
$("#header").addClass('scroll');
$("#header h1 img").attr('src', tpl + '/img/logo_0330_color.png');
$("#scrollTop").stop(true,false).fadeIn(300);
}
// Çì´õ ½ºÅ©·Ñ ºñÈ°¼ºÈ ÇÔ¼ö
function scrollInactive() {
$("#header").removeClass('scroll');
if(!$("body").hasClass('main') && !$("body").hasClass('visual')) {
$("#header h1 img").attr('src',tpl + '/img/logo_0330_color.png');
} else {
$("#header h1 img").attr('src',tpl + '/img/logo_0210.png');
}
$("#scrollTop").stop(true,false).fadeOut(300);
}
// ÃÖ»ó´Ü ½ºÅ©·Ñ ¹öÆ° Ŭ¸¯
$("#scrollTop a").click(function(e) {
e.preventDefault();
$("html, body").stop(true,false).animate({scrollTop:0}, 400, 'easeOutCubic');
});
// ÃÖ»ó´Ü ½ºÅ©·Ñ ¹öÆ° ¸¶¿ì½º¿£ÅÍ/¸®ºê
$("#scrollTop a").mouseenter(function() {
if(!$(this).hasClass('on')) {
$(this).addClass('on');
}
}).mouseleave(function() {
$(this).removeClass('on');
});
// ½ºÅ©·Ñ ó¸®
$(window).scroll(function() {
var _top = $(this).scrollTop();
if(_top > 50) {
if(!$("#header").hasClass('scroll')) { scrollActive(); }
} else {
if(isPC()===true) {
scrollInactive();
} else {
if(!$(".lnb_wrap").is(':visible')) {
scrollInactive();
}
}
}
});
// ¸®»çÀÌ¡ ó¸®
$(window).resize(function() {
var wSize = $(this).width();
if(wSize > 1024) {
bodyUnlock();
$(".lnb_wrap, #lnb > li > a").removeAttr('style');
}
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'});
}
});
subActive();
});
// ¼ºêÆäÀÌÁö ÅؽºÆ® ÀÌÆåÆ®
$(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).load(function() {
if($("#sub_visual").length > 0) {
$("#sub_visual img").addClass('load');
}
});