Intro
์๋ ํ์ธ์. ๋ชจ๋ฐ์ผ ๋ค๋น๊ฒ์ด์ ๋ฉ๋ด์์ ์คํฌ๋กค ์ด๋์ ํํํด์ผ ํ์ต๋๋ค. ์ฌ๋ฌ ๋ฐฉ๋ฒ์ด ์๊ฒ ์ง๋ง ์ ๋ ํน์ ์์ ์์น๋ก ์คํฌ๋กค ์ด๋ํ ์ ์๋ scrollIntoView ํจ์๋ฅผ ์ฌ์ฉํ์ต๋๋ค.
Syntax
scrollIntoView()
scrollIntoView(alignToTop)
scrollIntoView(scrollIntoViewOptions)
alignToTop
- true : aligned to the top ์๋จ ๊ธฐ์ค ์คํฌ๋กค ์ด๋ | scrollIntoViewOptions: {block: "start", inline: "nearest"}
- false : aligned to the bottom ํ๋จ ๊ธฐ์ค ์คํฌ๋กค ์ด๋ | scrollIntoViewOptions: {block: "end", inline: "nearest"}
scrollIntoViewOptions
- behavior : ์๋๋ฉ์ด์ | smooth, instant, auto
- block : ์์ง ์ ๋ ฌ | start, center, end, or nearest. Defaults to start
- inlihne : ์ํ ์ ๋ ฌ | start, center, end, or nearest. Defaults to nearest
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView