스타일 scrollBehavior 속성
예시
페이지에 부드러운 스크롤 효과 추가:
document.documentElement.style.scrollBehavior = "smooth";
정의 및 사용
scrollBehavior 속성은 사용자가 스크롤 가능한 상자 내의 링크를 클릭할 때 직선 점프 대신 스크롤 위치에 부드럽게 애니메이션을 적용할지 여부를 지정합니다.
브라우저 지원
Property | |||||
---|---|---|---|---|---|
scrollBehavior | 61.0 | 79.0 | 36.0 | 14.0 | 48.0 |
통사론
object.style.scrollBehavior = "auto|smooth|initial|inherit"
속성 값
Value | Description |
---|---|
auto | Default. Allows a straight jump "scroll effect" between elements within the scrolling box. |
smooth | Allows a smooth animated "scroll effect" between elements within the scrolling box. |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
관련 페이지
CSS 참조: 스크롤 동작 속성
❮ 스타일 개체