반응형
1. aos가 발동됐을 때 이벤트 추가
document.addEventListener('aos:in', ({ detail }) => {
const bestSwiperElem = detail.classList.contains('best-section');
if(bestSwiperElem) {
this.bestSwiper.params.autoplay = {
delay: 2500,
disableOnInteraction: false,
};
}
});
best-section에 도달했을 때 이벤트를 추가할 수 있음.
2. aos에 사용자 정의 애니메이션 추가
HTML
<div data-aos="new-animation"></div>
CSS
[data-aos="new-animation"] {
opacity: 0;
transition-property: transform, opacity;
&.aos-animate {
opacity: 1;
}
@media screen and (min-width: 768px) {
transform: translateX(100px);
&.aos-animate {
transform: translateX(0);
}
}
}
반응형
'JS, jQuery' 카테고리의 다른 글
aos 라이브러리 위치 초기값 수정 (0) | 2025.01.21 |
---|---|
swiper로 부드럽게 자동 롤링 구현하기 (0) | 2025.01.17 |
swiper loop 에러 (0) | 2024.06.17 |
[Javascript] NodeList 속성 (0) | 2023.08.20 |
[JavaScript] DOM 개념정리와 load 이벤트 (0) | 2023.08.16 |