Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- modal
- TAILWIND
- 앵귤러 애니메이션
- 검색
- Angular Router
- Oracle LISTAGG 사용 예시
- 스크롤 이벤트
- flex-1
- formgroup
- ApexChart
- angular button
- mysql if
- route
- angular modal
- Router
- angular animation
- scroll
- ajax 사용 예시
- 아이오닉 스크롤 이벤트
- 호버
- 스크롤 이벤트 감지
- summary
- 옵저버블
- prisma
- Ionic modal
- 앵귤러 모달
- egov spring ajax 사용 예시
- angular route
- 셀렉트박스 커스텀
- 모달
Archives
- Today
- Total
깜놀하는 해므찌로
Angular Swiper CSS is not working 앵귤러 스와이퍼 CSS 먹통 문제 해결 방안 예시 본문
반응형
SMALL
<!-- swiper -->
<swiper-container #swiperContainer class="z-10 w-5/6 mx-auto index5" init="false">
<swiper-slide
class="swiper-slide animation-item"
*ngFor="let phone of phones"
>
<div class="overflow-hidden">
<img
src="https://picsum.photos/400/300"
class="rounded-md w-96 h-44 sm:w-[30rem] sm:h-52 md:w-80 md:h-64"
/>
</div>
</swiper-slide>
</swiper-container>
0. #swiperContainer 선언
1. init="false" 설정 필수! 이 설정을 하지 않으면 임의로 CSS를 그려버려서 CSS 설정 및 값 오버라이딩 등 먹통됩니다.
@ViewChild('swiperContainer') swiperEl!: ElementRef<SwiperContainer>;
ngAfterViewInit(): void {
this.setSwiper();
}
setSwiper() {
const options: SwiperOptions = {
speed: 3000,
autoplay: {
delay: 5000,
},
allowTouchMove: false,
touchRatio: 0,
loop: true,
slidesPerView:
document.documentElement.clientWidth >= 1440
? 4
: document.documentElement.clientWidth >= 640
? 2
: 1,
spaceBetween: 20,
direction: 'horizontal',
};
Object.assign(this.swiperEl.nativeElement, options);
this.swiperEl.nativeElement.initialize();
}
@HostListener('window:resize', ['$event'])
onResize(event: any) {
this.setSwiper();
}
2. swiperEl.initialize() : 템플릿에서 init false 설정을 했으므로 수동으로 init 해야합니다.
반응형
LIST
'IT' 카테고리의 다른 글
Ionic Angular Scroll to Top 앵귤러 페이지 이동 시 스크롤 최상단 배치 예시 feat.smooth (0) | 2023.07.22 |
---|---|
NGX Anuglar Store 이론 및 활용 예시 (0) | 2023.07.21 |
Angular Template async 활용 / Observable 옵저버블 일반 타입 변환 예시 (0) | 2023.07.19 |
Angular Stagger Animation 앵귤러 스태거 애니메이션 예시 / 한줄씩 등장하는 애니메이션 (0) | 2023.07.18 |
Observable Http통신 배열로 받는 법 예시 / async, await, error (0) | 2023.07.17 |