โ๏ธ Header์ ๊ณ ์ ๋ค๋น๊ฒ์ด์
(+ ํ ํดํด๋์ค)
โ๏ธ GSAP ์ด์ฉ๋ฐฉ๋ฒ
โ๏ธ postion : sticky
โ๏ธ Swiper ์ฌ๋ผ์ด๋ ์ฌ์ฉ๋ฐฉ๋ฒ
โ๏ธ onEnter / onLeaveBack๋ก ๋ฐฐ๊ฒฝ์์ ๋ฐ๊พธ๊ธฐ
Google Cloud๋ฅผ ํ ๋ง๋ก archipelago productions, google๋ฑ ๋ํผ๋ฐ์ค ์ฌ์ดํธ๋ฅผ ์ฐธ๊ณ ํ์ฌ ๋ฆฌ๋ด์ผํ์ต๋๋ค.

ํค๋ ์๋จ์ ๋ค๋น๊ฒ์ด์ ์ ๋์ด ๊ณ ์ ๋๊ฒ๋ ํ์ต๋๋ค.
.header .navbar{
position: fixed; max-width: 1500px; min-width: 950px;
padding: 0 25px; border-radius: 5px;
width: 100%; left: 0; right: 0; top: 25px;
margin-left: auto; margin-right: auto; z-index: 99;
}
๋ํ, ํญ๋ฉ๋ด๋ฅผ ๋๋ฅด๋ฉด ๊ฐํธํ๊ฒ ์ฌ๋ซ์ ์ ์๊ฒ ํ ๊ธํด๋์ค๋ฅผ ์ฃผ์์ต๋๋ค.
.dropdown-menu{
position: absolute; opacity: 0; visibility: hidden;
padding: 0 25px; padding-top: 5px;
top: 100%; left: 0%; width: 100%; transition: .3s;
}
.dropdown-menu.on{opacity: 1; visibility: visible;}
$('.header .btn-dropdown .nav-item').click(function(){
$('.dropdown-menu').toggleClass('on')
})

๋ฐฐ๊ฒฝ ๋์์ ์๋ก width:50%์ ํฌ๊ธฐ์ ์ด๋ฏธ์ง๊ฐ ์ผ์ชฝ(transform : 'translateX(-100%)')์์ ์ค๋ฅธ์ชฝ(transform : 'translateX(0%)')์ผ๋ก ์์ฐ์ค๋ฝ๊ฒ ๋์ค๊ฒ๋ ํ์ต๋๋ค.
gsap.to('.sc-visual .group-text',{
scrollTrigger:{
trigger:'.sc-visual',
start:'0% -20%',
end:'100% 0%',
scrub:1,
},
transform: "translateX(0%)"
})
position : sticky ๋ ์คํฌ๋กค์ด ๋์ด์ ์ด ์์๊ฐ ํ๋ฉด์ ๋์ค๋ฉด ๊ณ ์ ์ํจ๋ค๋ ํน์ฑ์ด ์์ต๋๋ค.
<section class="sc-visual">
<div class="sticky-wrapper">
<div class="sticky">
<div class="video">
<video autoplay="" muted="" playsinline="" loop="">
<source src="./assets/images/Google Cloud_ The new way to cloud.mp4" type="video/mp4">
</video>
</div>
<div class="group-text">
<div class="area1">
<h2 class="text1">Cloud with the new. Google Cloud</h2>
</div>
<div class="text2">
The new way to cloud <br>
<span class="diff">Starts here.</span>
</div>
<div class="text3">Build with generative AI, deploy apps fast, and analyze data in secondsโall with Google-grade security. Build with the cloud platform designed for developers and AI. Try Google Cloud with free usage of over 20 products, plus new customers get $300 in free credits on signup.
</div>
<a href="">
<button class="btn-contact">
<p>Get started for free</p>
<div class="arrow">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.6262 5.63604C4.6262 5.08375 5.07391 4.63604 5.6262 4.63604L18.364 4.63604C18.9162 4.63604 19.364 5.08375 19.364 5.63604V18.6875C19.364 19.2398 18.9162 19.6875 18.364 19.6875C17.8117 19.6875 17.364 19.2398 17.364 18.6875V8.05025L6.34314 19.0711C5.95262 19.4616 5.31945 19.4616 4.92893 19.0711C4.5384 18.6805 4.5384 18.0474 4.92893 17.6569L15.9497 6.63604L5.6262 6.63604C5.07391 6.63604 4.6262 6.18832 4.6262 5.63604Z" fill="currentColor" stroke="#currentColor" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</div>
</button>
</a>
</div>
</div>
</div>
</section>
[css]
.sc-visual{ position: relative; height: 400vh; }
.sc-visual .sticky-wrapper{ height: 500vh; }
.sc-visual .sticky{ position: sticky; top: 0; height: 100vh; }
์ด๋ฏธ์ง์ position : sticky๋ฅผ ์ฃผ๋ฉด ์คํฌ๋กค์ด ๋์ด์ ์ด๋ฏธ์ง๊ฐ ๋ณด์ด๋ ์๊ฐ
viewport์ ๋งจ ์์์๋ถํฐ 100px ์์น์์ ๊ณ ์ ์ด ๋ฉ๋๋ค.
๊ทธ๋ฆฌ๊ณ ๋ถ๋ชจ ๋ฐ์ค๋ฅผ ๋์ด์ ์คํฌ๋กค ๋๋ฉด ์ด๋ฏธ์ง๋ ๊ฐ์ด ์ฌ๋ผ์ง๋๋ค.
position : sticky๋
=> ์ ํํ๋ ์คํฌ๋กค์ ํ ๋งํ ์ฌ์ด์ฆ๊ฐ ๋๋ ๋ถ๋ชจ ๋ฐ์ค๊ฐ ํ์
=> ์กฐ๊ฑด๋ถ๊ฐ ์์ผ๋ฉด, sticky ์์ฑ์ด ๋ฐ๋ํ์ง ์์
position : sticky์ ๋ถ๋ชจ ๋ฐ์ค๋ฅผ ์คํฌ๋กคํ๋ค๊ฐ ๋์ด๊ฐ์ ๋, sticky ์์ฑ์ด ํ๋ฆฌ๊ฒ ๋๋ค.

ํด๋น ์น์ ์ ๋์ค๋ ์์๋ค์ด ์ฌ๋ฌ๊ฐ์ง์ผ ๊ฒฝ์ฐ, ์ฌ๋ผ์ด๋๋ฅผ ์ด์ฉํ์ฌ ์ฌ๋ฌ๊ฐ๋ฅผ ํ ํ์ด์ง์ ๋ณด์ฌ์ค ์ ์๊ฒ๋ Swiper์ฌ๋ผ์ด๋๋ฅผ ์ฌ์ฉํ์ต๋๋ค.
var swiper = new Swiper('.goodthing-slide',{
slidesPerView:'auto',
spaceBetween:20,
pagination:{
el:'.pagination',
type:'progressbar'
},
})
swiper๋ ํ๋์จ์ด ๊ฐ์ ์ ํ ๋ฐ ๋ค์ํ ๊ธฐ๋ณธ ๋์์ ๊ฐ์ถ ํ๋์ ์ธ ์ฌ๋ผ์ด๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๋ปํ๋ค.
slidesPerView : ํ ๋ฒ์ ํ๋ฉด์ ํ์๋๋ ์ฌ๋ผ์ด๋๋ ํญ๋ชฉ์ ์
spaceBetween : ๊ฐ ์ฌ๋ผ์ด๋ ์ฌ์ด์ ๊ฐ๊ฒฉ์ ์กฐ์ ํ๋ ๋งค๊ฐ๋ณ์
pagination : ๊ธด ๋ชฉ๋ก์ด๋ ๋ด์ฉ์ ์ฌ๋ฌ ํ์ด์ง๋ก ๋๋์ด ๋ณด์ฌ์ฃผ๋ ๊ธฐ์ ์ด๋ ์ธํฐํ์ด์ค
el:'.pagination' : pagination ์ปจํธ๋กค์ด๋ ํ์ด์ง ๋ฒํธ๋ฅผ ํ์ํ๋ ์ปดํฌ๋ํธ
type:'progressbar' : ํ๋ก๊ทธ๋ ์ค ๋ฐ๊ฐ ๊ทธ๋ํฝ์ ์ผ๋ก ํํ๋์ด ์ฌ์ฉ์์๊ฒ ์์
์ ์งํ ์ํฉ์ ๋ณด์ฌ์ค

๋ฐฐ๊ฒฝ์ ๋ฐ๋๊ธฐ์ (background:#000;) โ ๋ฐฐ๊ฒฝ์ ๋ฐ๋ํ (background:#fff;)
[html]
<div data-bg="1">
<div class="sc-intro">
<div class="text-wrap">
<div class="title">
Build and scale generative AI apps with<br>
<span class="font">Vertex AI and Duet AI</span>
</div>
<a href="#sc-work" class="btn-select colorChange">
<p>AI innovation happens on Google Cloud</p>
<div class="down arrow">
<svg width="384" height="auto" viewBox="0 0 384 437" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M180.7 400.3C186.9 406.5 197.1 406.5 203.3 400.3L367.531 236.069C373.731 229.869 373.731 219.669 367.531 213.469C361.331 207.269 351.131 207.269 344.931 213.469L208 350.4V49.75C208 40.95 200.8 33.75 192 33.75C183.2 33.75 176 40.95 176 49.75V350.4L57.1809 213.469C50.9809 207.269 40.7809 207.269 34.5809 213.469C28.3809 219.669 28.3809 229.869 34.5809 236.069L180.7 400.3Z" fill="currentColor" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</div>
</a>
</div>
</div>
</div>
[css]
[data-bg="1"]{ position: relative; background-color: #000; height: 600vh; transition: .3s; }
[data-bg="1"].on{ background-color: #fff; }
[javascript]
ScrollTrigger.create({
trigger:'.sc-work',
start:'0% 50%',
end:'100% 0%',
onEnter:function(){
$('[data-bg="1"]').addClass('on')
},
onLeaveBack:function(){
$('[data-bg="1"]').removeClass('on')
}
})
dataset์ ์ด์ฉํ์ฌ (๊ฐ์ฒด ํ์์ด๊ธฐ ๋๋ฌธ์ ์ฝ๊ธฐ,์ฐ๊ธฐ๋ฑ์ ์์ฝ๊ฒ ์์ ํ์ฌ ์ฌ์ฉ๊ฐ๋ฅ) ์์ฑ๊ฐ์ ์ง์ ํ์ฌ, css์ ์คํฌ๋ฆฝํธ์์ background๋ฅผ ์ ์ฉํ ์ ์๊ฒ๋ ๋ง๋ค์์ต๋๋ค.
์ฐธ๊ณ ์ฌ์ดํธ
https://apost.dev/680/
https://velog.io/@sunny_afterrain/knowledge02
https://blog.pumpkin-raccoon.com/119
https://velog.io/@gil0127/position-sticky-%ED%99%9C%EC%9A%A9%ED%95%98%EA%B8%B0