메인 스크롤다운 로직 변경

This commit is contained in:
ecpla 2023-03-14 09:53:52 +09:00
parent ef73d13e47
commit 355d283004
2 changed files with 12 additions and 10 deletions

View File

@ -29,7 +29,7 @@ $(document).ready(function() {
$(window).on('resize', function() { $(window).on('resize', function() {
//브라우저 크기 확인 실시 //브라우저 크기 확인 실시
var windowHeight = $(window).height(); //요소의 높이를 반환 var windowHeight = $(window).height(); //요소의 높이를 반환
if(windowHeight < 440) { if(windowHeight < 480) {
$('#btn-scroll').removeClass("btn-scroll-fix"); $('#btn-scroll').removeClass("btn-scroll-fix");
$('#btn-scroll').addClass("btn-scroll-hide"); $('#btn-scroll').addClass("btn-scroll-hide");
}else { }else {
@ -48,6 +48,7 @@ $(document).ready(function() {
// 반드시 요소가 화면에 보여야 할경우 // 반드시 요소가 화면에 보여야 할경우
return (((y + elementHeight) < (viewportHeight + scrolltop)) && (y > (scrolltop - elementHeight))); return (((y + elementHeight) < (viewportHeight + scrolltop)) && (y > (scrolltop - elementHeight)));
}; };
$(window).on('scroll', function() { $(window).on('scroll', function() {
@ -75,20 +76,21 @@ $(document).ready(function() {
return false; return false;
} }
$('#btn-scroll').attr('onclick','fn_Move('+seq+')'); $('#btn-scroll').attr('onclick','fn_Move('+seq+')');
return false;
} }
}); });
}); });
}); });
function fn_Move(seq) { function fn_Move(seq) {
//section 별 width 달라서 interval 처리 //section 별 width 달라서 interval 처리
var interval = 100; var container = $('html, body');
var offset = $("#sec" + seq).offset(); var scrollTo = $("#sec" + seq);
if(seq > 4) interval = 250; var position = scrollTo.offset().top - container.offset().top;
$('html, body').animate({ container.animate({
scrollTop: offset.top - interval scrollTop: position
}, 300); });
return false; return false;
} }

View File

@ -326,7 +326,7 @@ footer .family_site {right:10px;}
.MainSwiper .pagination {bottom: 55px;left: calc(50% - -135px);} .MainSwiper .pagination {bottom: 55px;left: calc(50% - -135px);}
.sec1 .inner .search-wrap form .condition_sear {right: 189px;} .sec1 .inner .search-wrap form .condition_sear {right: 189px;}
.sec1 .inner .search-wrap .ark_query {width:204px;} .sec1 .inner .search-wrap .ark_query {width:190px;}
.sec1 .inner .color-box { width: 100vw; padding: 0 16px; box-sizing: border-box; top: -45px; } .sec1 .inner .color-box { width: 100vw; padding: 0 16px; box-sizing: border-box; top: -45px; }
.sec1 .inner .color-box .list { height: 85px; display: flex; align-items: center; flex-direction: column-reverse; } .sec1 .inner .color-box .list { height: 85px; display: flex; align-items: center; flex-direction: column-reverse; }