| ์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ | 
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 
| 16 | 17 | 18 | 19 | 20 | 21 | 22 | 
| 23 | 24 | 25 | 26 | 27 | 28 | 29 | 
| 30 | 
- ์ผ์ดํ๋ฐ๋ชฌํํฐ์ค
 - ์คํฌ๋กค์ ๋๋ฉ์ด์ 
 - ๊ฐ์์์ด๋
 - ์น์ ๊ทผ์ฑ
 - UX๋์์ธ
 - ์ผ๋ฐํ
 - ํํธ๋ฆญ์ค
 - ๊ณจ๋
 - ๋ฐ๋ง์ผํ
 - ๋ทํ๋ฆญ์คost
 - ๋คํฌ๋ชจ๋
 - ๋คํฌ๋ชจ๋ํ ๊ธ
 - ํ๋ก ํธ์๋
 - ์๋ฐ์คํฌ๋ฆฝํธui
 - ์ ๊ทผ์ฑ
 - ์๋ฐ์คํฌ๋ฆฝํธ
 - ์นUI
 - ์ฌ์๋ณด์ด์ฆ
 - kpopdemonhunters
 - Golden
 - UIUX
 - js์คํฌ๋กค์ด๋ฒคํธ
 - ๋ฐ๋๋ผjs
 - ๋ทํ๋ฆญ์ค์ ๋๋ฉ์ด์ 
 - ์น๋์์ธ
 - ๋น๋ณด๋์ฐจํธ
 - ui์ปดํฌ๋ํธ
 - JavaScript
 - ๋ฐ๋๋ผ์คํฌ๋ฆฝํธ
 - ์น๊ฐ๋ฐ
 
- Today
 
- Total
 
UI Code Lab
๐ ์คํฌ๋กค ํผ์ผํธ ๊ธฐ๋ฐ ํ๋ก๊ทธ๋ ์ค ๋ฐ ๋ง๋ค๊ธฐ – ๋ฐ๋๋ผ JS๋ก ๊ตฌํํ๋ ์ค์  UI ๋ณธ๋ฌธ
๐ ์คํฌ๋กค ํผ์ผํธ ๊ธฐ๋ฐ ํ๋ก๊ทธ๋ ์ค ๋ฐ ๋ง๋ค๊ธฐ – ๋ฐ๋๋ผ JS๋ก ๊ตฌํํ๋ ์ค์  UI
๐ฏ๊ฟ์์ด๐ 2025. 7. 22. 10:51
์น์ฌ์ดํธ๋ฅผ ์ฝ๋ค ๋ณด๋ฉด ์๋จ์ ์์ ๋ฐ๊ฐ ์ค๋ฅด๋ฅต ์ฐจ์ค๋ฅด๋ ๊ฑธ ๋ณธ ์  ์์ผ์ ๊ฐ์?
์ด๊ฑด ๋ฐ๋ก ์คํฌ๋กค ํผ์ผํธ ๊ธฐ๋ฐ ํ๋ก๊ทธ๋ ์ค ๋ฐ(progress bar)์ ๋๋ค.
์ฌ์ฉ์๊ฐ ํ์ด์ง๋ฅผ ์ผ๋ง๋ ์ฝ์๋์ง ์ง๊ด์ ์ผ๋ก ๋ณด์ฌ์ฃผ๋ UI๋ก,
์ฌ์ฉ์ ๊ฒฝํ(UX)์ ๋์ด๋ ๋ฐ ํจ๊ณผ์ ์ด์์.
์ด๋ฒ ๊ธ์์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์์ด ๋ฐ๋๋ผ JavaScript๋ง์ผ๋ก
์ด ๊ธฐ๋ฅ์ ๊ตฌํํ๋ ๋ฐฉ๋ฒ์ ์๊ฐํฉ๋๋ค.
๐ฏ ๊ตฌํ ๋ชฉํ
- ์ฌ์ฉ์๊ฐ ์คํฌ๋กคํ ๋น์จ์ ๋ฐ๋ผ ์๋จ ๋ฐ์ ๋๋น๊ฐ ์ค์๊ฐ์ผ๋ก ๋ณํจ
 - HTML, CSS, JavaScript๋ง ์ฌ์ฉ
 - ๋ฐ์ํ ์น์์๋ ์์ฐ์ค๋ฝ๊ฒ ์๋
 
๐งฉ HTML ๊ตฌ์กฐ
<div class="progress-container">
  <div class="progress-bar"></div>
</div>
- progress-container: ์ ์ฒด ํ๋ก๊ทธ๋ ์ค ๋ฐ ์์ญ
 - progress-bar: ์ค์  ๋๋น๊ฐ ๋ณํ๋ ๋ฐ ์์
 
๐จ CSS ์คํ์ผ๋ง
.progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background-color: #eee;
  z-index: 9999;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background-color: #3b82f6;
  transition: width 0.1s ease-out;
}
- ์๋จ์ ๊ณ ์ ๋๋๋ก position: fixed ์ฌ์ฉ
 - transition์ผ๋ก ๋ถ๋๋ฌ์ด ๋๋น ๋ณํ ํจ๊ณผ ์ ์ฉ
 
โ๏ธ JavaScript ๋ก์ง
window.addEventListener("scroll", () => {
  const scrollTop = document.documentElement.scrollTop;
  const scrollHeight = document.documentElement.scrollHeight;
  const clientHeight = document.documentElement.clientHeight;
  const scrollPercent = (scrollTop / (scrollHeight - clientHeight)) * 100;
  document.querySelector(".progress-bar").style.width = scrollPercent + "%";
});
- scrollTop: ํ์ฌ ์คํฌ๋กค ์์น
 - scrollHeight: ์ ์ฒด ๋ฌธ์ ๋์ด
 - clientHeight: ํ๋ฉด ๋์ด
 - ๊ณ์ฐ๋ scrollPercent๋ฅผ ๋ฐ ๋๋น๋ก ๋ฐ์
 
๐ก ํ์ฅ ์์ด๋์ด
- ์์ ๋ณ๊ฒฝ: ์คํฌ๋กค ์์น์ ๋ฐ๋ผ ์์ ๋ณํ
 - ์น์ ๋ณ ์งํ๋ฅ : ํน์  ์น์ ๋ง๋ค ๋ณ๋ ๋ฐ ํ์
 - ์ฑ๋ฅ ์ต์ ํ: throttle ๋๋ requestAnimationFrame ํ์ฉ
 
๐งพ ๋ง๋ฌด๋ฆฌ
์คํฌ๋กค ํผ์ผํธ ๊ธฐ๋ฐ ํ๋ก๊ทธ๋ ์ค ๋ฐ๋ ๋จ์ํ์ง๋ง
์ฌ์ฉ์์๊ฒ ์ฝ๊ธฐ ์งํ๋ฅ ์ ์ง๊ด์ ์ผ๋ก ๋ณด์ฌ์ฃผ๋ ํ๋ฅญํ UI์ ๋๋ค.
๋ผ์ด๋ธ๋ฌ๋ฆฌ ์์ด๋ ์ถฉ๋ถํ ๊ตฌํ ๊ฐ๋ฅํ๋ฉฐ,
๋ค์ํ ํ์ฅ ๊ธฐ๋ฅ์ผ๋ก UX๋ฅผ ๋์ฑ ํฅ์์ํฌ ์ ์์ด์.
์ด์  ์ฌ๋ฌ๋ถ์ ๋ธ๋ก๊ทธ๋ ํ๋ก์ ํธ์ ์ง์  ์ ์ฉํด๋ณด์ธ์!
๋ค์ ๊ธ์์๋ ๋คํฌ ๋ชจ๋ ํ ๊ธ ๊ธฐ๋ฅ์ ์๊ฐํ ์์ ์ด๋ ๊ธฐ๋ํด์ฃผ์ธ์. ๐