Inflearn brand logo image

Inflearn Community Q&A

dev8983's profile image
dev8983

asked

Apple website interaction clone!

50vh

Written on

·

245

0

.scroll-section {
    position: relative;
    padding-top: 50vh;
}

위와 같이 padding-top에 50vh를 넣고

setLayout함수에서 

       if (sceneInfo[i].type === 'sticky') {
                sceneInfo[i].scrollHeight = sceneInfo[i].heightNum * window.innerHeight;
            } else if (sceneInfo[i].type === 'normal')  {
                sceneInfo[i].scrollHeight = sceneInfo[i].objs.content.offsetHeight + window.innerHeight * 0.5;
            }
            sceneInfo[i].objs.container.style.height = `${sceneInfo[i].scrollHeight}px`;

sticky인 경우 innerHeight의 배수만큼만, normal인 경우 실제 높이에 50vh 만큼을 더해주고 있습니다.

질문1: 어짜피 setLayout에서 높이를 재설정하고 있는데 css에서 패딩을 주는 이유가 무엇일까요?

질문2: sticky와 normal에 50vh의 보정이 서로 다르게 들어가는 이유는 무엇일까요?

감사합니다~~

HTML/CSSsvg인터랙티브-웹javascript웹 디자인클론코딩

Answer

This question is waiting for answers
Be the first to answer!
dev8983's profile image
dev8983

asked

Ask a question