fn_move function 수정

This commit is contained in:
ecpla 2023-04-04 13:12:27 +09:00
parent cc7a983ad3
commit 0d74cf20bc

View File

@ -68,13 +68,13 @@ $(document).ready(function() {
// 스크롤 할때마다 다음 section값으로 수정
$('.sec').each(function(index, item){
if ($(item).isInViewport()) {
var seq = index+2;
if(seq == 8) { //마지막 순서 안보이게 처리
var seq = index+1;
/* if(seq == 8) { //마지막 순서 안보이게 처리
$('#btn-scroll').removeClass("btn-scroll-fix");
$('#btn-scroll').addClass("btn-scroll-hide");
$('#btn-scroll').attr('onclick','');
return false;
}
} */
$('#btn-scroll').attr('onclick','fn_Move('+seq+')');
return false;
}
@ -85,8 +85,9 @@ $(document).ready(function() {
function fn_Move(seq) {
//section 별 width 달라서 interval 처리
var container = $('html, body');
var scrollTo = $("#sec" + seq);
var position = scrollTo.offset().top - container.offset().top;
// var scrollTo = $("#sec" + seq);
var scrollTo = $(".sec").eq(seq);
var position = scrollTo.offset().top - container.offset().top - 100;
container.animate({
scrollTop: position
});