var listScroll = 0; //리스트 초기값 var isScroll = false; //상세 초기값 // 프로젝트 리스트 삽입 function dataList(){ var listLength = htmlData.length; var html_list = ""; var html_list_history = ""; for(var i=0; i'; html_list += '
'; html_list += '
'; html_list += '

' + htmlData[i].INPUT_CLIENT + '

'; html_list += '

' + htmlData[i].INPUT_TEXT1 + '
' + htmlData[i].INPUT_TEXT2 +'

'; html_list += '
'; html_list += '
'; html_list += '
'; html_list += ' '; html_list += ''; } else { if(i < 12){ html_list_history += '
  • '; html_list_history += ' ' + htmlData[i].INPUT_CATEGORY +''; html_list_history += ' ' + htmlData[i].INPUT_TEXT1 +' ' + htmlData[i].INPUT_TEXT2 +''; html_list_history += ' ' + htmlData[i].INPUT_DATE +''; html_list_history += '
  • '; } } // 더보기버튼 노출/비노출 if(i < 12) { $(".contents_projects .btn_more").hide(); } else { $(".contents_projects .btn_more").show(); } } $(".contents_projects .list").html(html_list); $(".contents_projects .history").html(html_list_history); } // 프로젝트 리스트 더보기 function moreData(count) { var listLength = htmlData.length; var html_list_more = ""; for(var i=0; i 5 && i < 13+count){ html_list_more += '
  • '; html_list_more += ' ' + htmlData[i].INPUT_CATEGORY +''; html_list_more += ' ' + htmlData[i].INPUT_TEXT1 +' ' + htmlData[i].INPUT_TEXT2 +''; html_list_more += ' ' + htmlData[i].INPUT_DATE +''; html_list_more += '
  • '; } } $(".contents_projects .history").html(html_list_more); if(listLength <= 12+count) $(".contents_projects .btn_more").hide(); //더보기 숨김 // console.log(listLength, 12+count); } // 프로젝트 상세 삽입 function dataDetail(seq){ var listLength = htmlData.length; if($("#projects_sub").is(":hidden")) listScroll = $(window).scrollTop(); for(var i=0; i'; } $("#projects_sub .detail_img").html(videoHtml); } else { $("#projects_sub .detail_img").html(""); } } } $("#container").css("height",0); $("#projects_sub").show().scrollTop(0); $("header").addClass("on"); var motionIdx = 0; $("#projects_sub .title").removeClass("on"); $("#projects_sub .info dl").removeClass("on"); $("#projects_sub .main_img").removeClass("on"); var motionTimer = setInterval(function(){ if(4 <= motionIdx) clearInterval(motionTimer); if(motionIdx == 0) $("#projects_sub .title").addClass("on"); if(motionIdx == 1) $("#projects_sub .info dl").eq(0).addClass("on"); if(motionIdx == 2) $("#projects_sub .info dl").eq(1).addClass("on"); if(motionIdx == 3) $("#projects_sub .info dl").eq(2).addClass("on"); if(motionIdx == 0) $("#projects_sub .main_img").addClass("on"); motionIdx++; },100); isScroll = false; } function bottomNextColor(){ if(!isScroll) nextOffsetY = $(".next_project").offset().top; if(nextOffsetY - $(window).height() + 140 < $("#projects_sub").scrollTop()) { $(".btn_list").addClass("on"); } else { $(".btn_list").removeClass("on"); } if(nextOffsetY < $("#projects_sub").scrollTop()) { $("header").removeClass("on"); } else { $("header").addClass("on"); } isScroll = true; } // 이벤트 함수 $(function(){ dataInit("home"); //데이터 가져오기 $("body, html").animate({"scrollTop":"0px"}, 0); /* 뒤로가기버튼 상세팝업닫기 */ window.addEventListener("hashchange", function(e) { if(location.href.indexOf("#detail") == -1) { $("header").removeClass("on"); $("#container").css("height","auto"); $("#projects_sub").hide(); $(window).scrollTop(listScroll); } }); /* 리스트 페이지 */ $(document).on("click", ".contents_projects .list li a, .contents_projects .history li a", function(){ var listSeq = $(this).attr("data-seq"); dataDetail(listSeq); }); // 더보기 버튼 var count = 0; $(".contents_projects .btn_more a").on("click", function(){ count = count+6; moreData(count); }); /* 상세 페이지 */ // 프로젝트 상세 스크롤 $("#projects_sub").on("scroll" ,function (){ bottomNextColor(); }); // 상단 다음버튼 (오버효과) $("#projects_sub .main_img .btn_next").on({ "mouseenter": function(){ $("#projects_sub .main_img .img_next").addClass("on"); }, "mouseleave": function(){ $("#projects_sub .main_img .img_next").removeClass("on"); } }); // 상단, 하단 다음버튼 $(document).on("click", "#projects_sub .btn_next, #projects_sub .img_next", function(){ var detailSeq = $(this).attr("data-seq"); dataDetail(detailSeq); }); // 리스트가기 버튼 $("#projects_sub .btn_list").on("click", function(){ $("header").removeClass("on"); $("#container").css("height","auto"); $("#projects_sub").hide(); $(window).scrollTop(listScroll); }); // 비디오제어 $(document).on("click", "#projects_sub .detail_img video", function(){ if($(this)[0].played) { $(this).siblings()[0].pause(); } }); });