// ¸ÞÀÎ ·Ñ¸µ À̹ÌÁö
$(function() {
var vCount = $("#mainSlider ul.imgList li").length;
var vIndex = 0;
var vTimer;
var vInterval = 4000; // ÀÚµ¿À¸·Î ½½¶óÀ̵ù µÇ´Â ÁÖ±â (´ÜÀ§ : ms)
var swipeOptions = {
triggerOnTouchEnd: true,
swipeStatus: swipeStatus,
allowPageScroll: "vertical",
threshold: 10
};
// ¸ÞÀÎ ·Ñ¸µÀ̹ÌÁö ½º¿ÍÀÌÇÁ ¼ÂÆÃ
function swipeStatus(event, phase, direction, distance) {
vWidth = $("#mainSlider ul.imgList li").width();
if (phase == "move" && (direction == "left" || direction == "right")) {
var duration = 0;
if (direction == "left") {
clearInterval(vTimer);
$("#mainSlider ul.imgList").stop(true,false).animate({left:-(vWidth*vIndex) - distance + 'px'}, duration);
} else if (direction == "right") {
clearInterval(vTimer);
$("#mainSlider ul.imgList").stop(true,false).animate({left:-(vWidth*vIndex) + distance + 'px'}, duration);
}
} else if (phase == "cancel") {
mainSlide();
} else if (phase == "end") {
if (direction == "right") {
if(vIndex===0) {
mainClear();
vIndex = 0;
mainSlide();
return false;
}
mainClear();
vIndex--;
mainSlide();
} else if (direction == "left") {
if(vIndex===vCount-1) {
vIndex = vCount-1;
mainClear();
mainSlide();
return false;
}
mainClear();
vIndex++;
mainSlide();
}
}
}
$("#mainSlider ul.imgList").swipe(swipeOptions);
// ÃʱâÈ
function mainInit() {
var wSize = $(window).width();
$("#mainSlider ul.imgList li").css('width',wSize + 'px');
$("#mainSlider ul.imgList").css('left',-(wSize * vIndex) + 'px');
}
// ÆäÀÌÁö³×ÀÌ¼Ç ÃʱâÈ
function pagingInit() {
var _li = "
";
for(i=0; i= vCount) {
vIndex = 0;
}
$("#mainSlider ul.imgList").stop(true,false).animate({left:-(vWidth*vIndex) + 'px'}, 600, 'easeOutCubic');
pagingActive();
}
// ¸ÞÀÎ ·Ñ¸µÀ̹ÌÁö ŸÀÌ¸Ó ÃʱâÈ
function mainClear() {
$("#mainSlider ul.imgList").stop();
clearInterval(vTimer);
vTimer = setInterval(function() { vIndex++; mainSlide(); }, vInterval);
}
// ÀÌÀü¹öÆ° Ŭ¸¯
$("#mainSlider a.prev").click(function() {
if(!$("#mainSlider ul.imgList").is(':animated')) {
mainClear();
vIndex--;
mainSlide();
}
});
// ´ÙÀ½¹öÆ° Ŭ¸¯
$("#mainSlider a.next").click(function() {
if(!$("#mainSlider ul.imgList").is(':animated')) {
mainClear();
vIndex++;
mainSlide();
}
});
// ÆäÀÌÁö³×ÀÌ¼Ç »óÅ º¯°æ
function pagingActive() {
$("#mainSlider ul.pagination li").removeClass('active');
$("#mainSlider ul.pagination li").eq(vIndex).addClass('active');
}
// ÆäÀÌÁö³×ÀÌ¼Ç Å¬¸¯½Ã
$(document).on('click', '#mainSlider ul.pagination li', function() {
var idx = $(this).index();
if(!$("#mainSlider ul.imgList").is(':animated')) {
mainClear();
vIndex = idx;
mainSlide();
}
});
// ÀÚµ¿ ½½¶óÀ̵å ŸÀÌ¸Ó ¼³Á¤
vTimer = setInterval(function() { vIndex++; mainSlide(); }, vInterval);
// ·Îµå½Ã ·Ñ¸µÀ̹ÌÁö ÃʱâÈ
$(window).load(function() {
mainInit();
pagingInit();
});
// È¸é »çÀÌÁî Á¶Àý½Ã ·Ñ¸µÀ̹ÌÁö »çÀÌÁî, À§Ä¡ ¸ÂÃã
$(window).resize(function() {
mainInit();
});
});
// ¸ÞÀÎ Æ÷Æ®Æú¸®¿À ½½¶óÀÌ´õ
$(function() {
var pCount = $("#photoSlide > .slide_wrap > div > table").length;
var pIndex = 0;
var pTimer;
var pInterval = 3000; // ÀÚµ¿À¸·Î ½½¶óÀ̵ù µÇ´Â ÁÖ±â (´ÜÀ§ : ms)
// ½½¶óÀÌ´õ ÃʱâÈ, »çÀÌÁî ¸ÂÃã
function photoInit() {
var wSize = $(window).width();
var slider = $("#photoSlide .slide_wrap");
var pcSize = slider.width() * 0.2375;
var pcMargin = slider.width() * 0.0166;
var tabSize = slider.width() * 0.31;
var tabMargin = slider.width() * 0.033;
var mobSize = slider.width();
var mobMargin = 0;
$("#photoSlide > .slide_wrap > div > table").removeAttr('width');
// â »çÀÌÁ·Î °¢°¢ ¾ÆÀÌÅÛ(li) »çÀÌÁ ¸ÂÃã
if(wSize > 1024) {
$("#photoSlide > .slide_wrap > div > table").css({'width':pcSize + 'px', 'marginRight':pcMargin + 'px'});
} else if (wSize > 639 && wSize < 1025) {
$("#photoSlide > .slide_wrap > div > table").css({'width':tabSize + 'px', 'marginRight':tabMargin + 'px'});
} else {
$("#photoSlide > .slide_wrap > div > table").css({'width':mobSize + 'px', 'marginRight':mobMargin + 'px'});
}
}
// ½½¶óÀÌµå ±â´É
function photoSlide() {
var wSize = $(window).width();
var pMargin = Number($("#photoSlide > .slide_wrap > div > table").css('marginRight').replace('px',''));
var pWidth = $("#photoSlide > .slide_wrap > div > table:first").width();
if(wSize > 1024) {
if(pIndex >= pCount - 3) {
pIndex = 0;
} else if(pIndex<=0) {
pIndex = pCount - 4;
}
} else if(wSize > 639 && wSize < 1025) {
if(pIndex >= pCount - 2) {
pIndex = 0;
} else if(pIndex<=0) {
pIndex = pCount - 3;
}
} else {
if(pIndex >= pCount) {
pIndex = 0;
} else if(pIndex<=0) {
pIndex = pCount - 1;
}
}
$("#photoSlide > .slide_wrap > div").stop(true,false).animate({left:-((pWidth+pMargin) * pIndex) + 'px'}, 500);
}
// ÀÚµ¿ ½½¶óÀ̵å ŸÀ̸Ó
pTimer = setInterval(function() { pIndex++; photoSlide(); }, pInterval);
// ½½¶óÀ̵å ŸÀÌ¸Ó Á¤Áö ¹× ÃʱâÈ (²¿ÀÓ ¹æÁö)
function photoClear() {
$("#photoSlide > .slide_wrap > div").stop();
clearInterval(pTimer);
pTimer = setInterval(function() { pIndex++; photoSlide(); }, pInterval);
}
// ¿µ¿ª ³» ¸¶¿ì½º ÁøÀÔ, ÀÌÅ»½Ã À̺¥Æ® ó¸® (ÄÁÆ®·Ñ ¹öÆ° Ç¥½Ã/¼û±è, ÀÚµ¿ ½½¶óÀ̵å Àç»ý/ÀϽÃÁ¤Áö)
$("#photoSlide .slide_wrap, #photoSlide a.control").mouseenter(function() {
$("#photoSlide a.control").stop(true,false).fadeIn(300);
clearInterval(pTimer);
});
$("#photoSlide .slide_wrap").mouseleave(function() {
$("#photoSlide a.control").stop(true,false).fadeOut(300);
pTimer = setInterval(function() { pIndex++; photoSlide(); }, pInterval);
});
// ÀÌÀü ¹öÆ° Ŭ¸¯
$("#photoSlide a.prev").click(function() {
if(!$("#photoSlide > .slide_wrap > div").is(':animated')) {
photoClear();
pIndex--;
photoSlide();
}
});
// ´ÙÀ½ ¹öÆ° Ŭ¸¯
$("#photoSlide a.next").click(function() {
if(!$("#photoSlide > .slide_wrap > div").is(':animated')) {
photoClear();
pIndex++;
photoSlide();
}
});
// ·Îµå½Ã ½½¶óÀÌ´õ ÃʱâÈ
$(window).load(function() {
photoInit();
});
// È¸é »çÀÌÁî Á¶Àý½Ã ½½¶óÀÌ´õ »çÀÌÁî, À§Ä¡ ¸ÂÃã
$(window).resize(function() {
photoInit();
});
});
// Ư°¡»óÇ° Æ˾÷ (±¸¸Å ÈÄ »èÁ¦ ¹Ù¶ø´Ï´Ù)
$(function() {
var _href = window.location.href;
if(_href.indexOf('bdmp') < 0) {
$("#pop_product").remove();
}
$("#pop_product a.close").click(function() {
$("#mask").css('display','none');
$("#pop_product").css('display','none');
});
});