특정 엘리먼트로 스크롤 이동시키는 방법
function Component() {
const componentRef = useRef(null);
const moveScroll = () => {
componentRef.current?.scrollIntoView({
behavior: "smooth"
})
}
return (
<div ref={componentRef}>스크롤 타겟 엘리먼트</div>
<button onClick={() => moveScroll}>스크롤 이동</button>
);
}
프론트엔드 비디오/오디오 소스 (0) | 2021.09.08 |
---|---|
카메라 테스트 (0) | 2021.09.08 |
Swiper JS 사용법 총정리 이걸로 끝 사용방법 (0) | 2020.07.06 |