// 메인 포스팅 롤링 $(function() { var $postElem = $(".postSlider"), $twElem = [], $iwElem = [], $postIndex = [], $postCount = [], $twSize = [], $iwSize = []; $postElem.each(function(i) { $twElem[i] = $(this).find('.textWrapper ul'); $iwElem[i] = $(this).find('.imgWrapper ul'); $postIndex[i] = 0; $postCount[i] = $twElem[i].children().length; i++; }); // 슬라이더 초기화 function postSliderInit() { for(i=0; i<$postElem.length; i++) { $twSize[i] = $twElem[i].parent().width(); $iwSize[i] = $iwElem[i].parent().width(); $twElem[i].children().css('width', $twSize[i] + 'px'); $twElem[i].css({'width':$twSize[i] * $postCount[i] + 'px', 'transform':'matrix(1,0,0,1,' + (-$twSize[i] * $postIndex[i]) + ',0)'}); $iwElem[i].children().css('width', $iwSize[i] + 'px'); $iwElem[i].css({'width':$iwSize[i] * $postCount[i] + 'px', 'transform':'matrix(1,0,0,1,' + (-$iwSize[i] * $postIndex[i]) + ',0)'}); } } // 포스트 슬라이드 함수 function postSliding(idx, easing) { if($postIndex[idx] < 0) { $postIndex[idx] = $postCount[idx] - 1; } else if($postIndex[idx] >= $postCount[idx]) { $postIndex[idx] = 0; } $twElem[idx].parents('.postSlider').find('.thumbList').children().removeClass('on'); $twElem[idx].parents('.postSlider').find('.thumbList').children().eq($postIndex[idx]).addClass('on'); if(!easing || easing == true) { TweenMax.to($iwElem[idx], 0.5, {x:-($iwSize[idx] * $postIndex[idx]), ease:Expo.easeInOut}); TweenMax.to($twElem[idx], 0.7, {x:-($twSize[idx] * $postIndex[idx]), ease:Expo.easeInOut}); } else if(easing == false) { TweenMax.to($iwElem[idx], 0.5, {x:-($iwSize[idx] * $postIndex[idx])}); TweenMax.to($twElem[idx], 0.7, {x:-($twSize[idx] * $postIndex[idx])}); } } // 포스트 슬라이더 썸네일 생성 function postThumbInit() { var $thumbTag = [], $thumbImg = []; for(i=0; i<$postElem.length; i++) { for(n=0; n<$postCount[i]; n++) { $thumbImg[n] = $iwElem[i].children().eq(n).find('img').attr('src'); $thumbTag[n] = '
'; $postElem.eq(i).find('.thumbList').append($thumbTag[n]); } $postElem.eq(i).find('.thumbList').children().eq(0).addClass('on'); } } // 상단 포스트 슬라이더 썸네일 클릭 $(document).on('click', '.section1 .thumbList > li', function() { var $tIndex = $(this).index(); $postIndex[0] = $tIndex; postSliding(0); }); // 상단 포스트 슬라이더 이전 $(".section1 .prev").click(function() { $postIndex[0]--; postSliding(0); }); // 상단 포스트 슬라이더 다음 $(".section1 .next").click(function() { $postIndex[0]++; postSliding(0); }); // 하단 포스트 슬라이더 썸네일 클릭 $(document).on('click', '#postSliderType2 .thumbList > li', function() { var $tIndex = $(this).index(); $postIndex[1] = $tIndex; postSliding(1); }); // 하단 포스트 슬라이더 이전 $(".section3 .prev").click(function() { $postIndex[1]--; postSliding(1); }); // 하단 포스트 슬라이더 다음 $(".section3 .next").click(function() { $postIndex[1]++; postSliding(1); }); // 상단 포스트 슬라이더 썸네일 클릭 $(document).on('click', '.section6 .thumbList > li', function() { var $tIndex = $(this).index(); $postIndex[2] = $tIndex; postSliding(2); }); // 상단 포스트 슬라이더 이전 $(".section6 .prev").click(function() { $postIndex[2]--; postSliding(2); }); // 상단 포스트 슬라이더 다음 $(".section6 .next").click(function() { $postIndex[2]++; postSliding(2); }); postSliderInit(); postThumbInit(); // 윈도우 사이즈 조절시 포스트 슬라이더 사이즈, 위치 맞춤 $(window).bind('resize', function() { postSliderInit(); }); }); // 메인 롤링이미지 $(function() { var $vIndex = 0; var $vElem = $("#mainSlider > .imgList"); var $vCount = $("#mainSlider > .imgList > li").length; var $vDuration = 3500; // 자동롤링 주기 (단위 : ms) var $vTimer; var swipeOptions = { // 터치 스와이프 옵션 triggerOnTouchEnd: true, swipeStatus: swipeStatus, allowPageScroll: "vertical", threshold: 0 }; $vElem.swipe(swipeOptions); // 터치스와이프 추가 // 터치스와이프 이벤트 지정 function swipeStatus(event, phase, direction, distance) { $vSize = $vElem.children().width(); if (phase == "move" && (direction == "left" || direction == "right")) { var duration = 0; if (direction == "left") { clearInterval($vTimer); TweenMax.to($vElem, duration, {x:-($vIndex * $vSize) - distance + 'px'}); } else if (direction == "right") { clearInterval($vTimer); TweenMax.to($vElem, duration, {x:-($vIndex * $vSize) + distance + 'px'}); } } else if (phase == "cancel") { visualSlide(); } else if (phase == "end") { if (direction == "right") { if($vIndex===0) { resetTimer(); $vIndex = 0; visualSlide(); return false; } resetTimer(); $vIndex--; visualSlide(); } else if (direction == "left") { if($vIndex===$vCount-1) { $vIndex = $vCount-1; resetTimer(); visualSlide(); return false; } resetTimer(); $vIndex++; visualSlide(); } } } // 메인 비주얼 사이즈 세팅 function visualInit() { var $winWidth = $(window).width(); var $vItem = $vElem.children(); var $initOpt = { 'transform':'matrix(1,0,0,1,' + (-$vIndex * $winWidth) + ', 0)', 'width':$winWidth * $vCount } $vElem.css($initOpt); $vItem.css({'width':$winWidth + 'px'}); } // 페이지네이션 초기화 function pagingInit() { var $item = ""; for(i=0; i<$vCount; i++) { $("#mainSlider > .pagination").append($item); } $("#mainSlider > .pagination > li:first").addClass('on'); } // 페이지네이션 클릭 $(document).on('click', '#mainSlider > .pagination > li', function() { if(!TweenMax.isTweening($vElem)) { var $pIndex = $(this).index(); resetTimer(); $vIndex = $pIndex; visualSlide(); } }); // 메인 비주얼 롤링 처리 function visualSlide() { var $winWidth = $(window).width(); if($vIndex >= $vCount) $vIndex = 0; TweenMax.to($vElem, 0.8, {x:-$vIndex * $winWidth + 'px', ease:Expo.easeOut, delay:0}); $("#mainSlider > .pagination > li").removeClass('on'); $("#mainSlider > .pagination > li").eq($vIndex).addClass('on'); } // 타이머 세팅 $vTimer = setInterval(function() { $vIndex++; visualSlide(); }, $vDuration); // 타이머 리셋 function resetTimer() { $vElem.stop(); clearInterval($vTimer); $vTimer = setInterval(function() { $vIndex++; visualSlide(); }, $vDuration); } visualInit(); pagingInit(); // 윈도우 리사이징 처리 $(window).bind('resize', function() { visualInit(); }); }); // 포토갤러리 추출 커스터마이징 $(function() { var tmpno = $(location).attr('pathname').split('/')[1]; console.log(tmpno);tmpno = ''; var dir = $(".section2 .listWrapper").data('dir'); var page = $(".section2 .listWrapper").data('page'); var elem; var photoAll = $(".section2 .listWrapper .tableArea").html(); var subject = new Array(); // 갤러리 썸네일 제목 배열변수 선언 var content = new Array(); // 갤러리 썸네일 내용 배열변수 선언 var content2 = new Array(); // 갤러리 썸네일 내용 배열변수 선언 var url = new Array(); // 각 썸네일별 링크 저장용 변수 var thumbCount; // 썸네일 개수 (추출개수) var refHeight; // 높이 동기화를 위한 변수 // 포토갤러리 카테고리 가져오기 function getCategory() { if($(".section2 .tableArea li").length > 0) { $("#cate-load").attr('src', tmpno + dir + page); $("#cate-load").load(function() { var title = [], cate_no = [], bo_table = [], cateHTML; $(".section2 .category").remove(); cateHTML = '' + $.trim(content[i]) + '
' + $.trim(content2[i]) + '
' + $.trim(content[i]) + '
' + $.trim(content2[i]) + '
' + $content[n] + '
'; $innerHTML += '