웹 css 애니메이션 모두 끄기
완전하게 끄는 방법이 있지만, 애니메이션 이벤트가 발생하지 않는 버그가 생길 수도 있습니다.
*, *::before, *::after {
animation-duration: 0s !important;
transition-duration: 0s !important;
}100ms 정도면 컴퓨터에 여유를 주면서 애니메이션이 빠르게 끝나므로 자원을 적게 소비합니다.
*, *::before, *::after {
animation-duration: .1s !important;
transition-duration: .1s !important;
}OS에서 절약 옵션을 사용하는 경우를 대상으로 가능합니다.
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto !important; /* 부드러운 스크롤 차단 */
}
*, *::before, *::after {
animation-duration: 0.01ms !important; /* 0s 대신 극소시간 부여 */
animation-iteration-count: 1 !important; /* 무한루프 방지 */
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
