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 | 29 | 30 | 31 |
Tags
- 모달
- egov spring ajax 사용 예시
- angular animation
- angular button
- flex-1
- 셀렉트박스 커스텀
- ajax 사용 예시
- Ionic modal
- 스크롤 이벤트 감지
- 앵귤러 모달
- 호버
- scroll
- Router
- mysql if
- modal
- 아이오닉 스크롤 이벤트
- route
- formgroup
- ApexChart
- 옵저버블
- summary
- Oracle LISTAGG 사용 예시
- prisma
- Angular Router
- 검색
- angular modal
- 앵귤러 애니메이션
- angular route
- 스크롤 이벤트
- TAILWIND
Archives
- Today
- Total
깜놀하는 해므찌로
Ionic Angular Scroll to Top 앵귤러 페이지 이동 시 스크롤 최상단 배치 예시 feat.smooth 본문
IT
Ionic Angular Scroll to Top 앵귤러 페이지 이동 시 스크롤 최상단 배치 예시 feat.smooth
agnusdei1207 2023. 7. 22. 19:38반응형
SMALL
<main
#container
class="flex w-screen h-screen overflow-x-hidden overflow-y-auto"
>
<router-outlet (activate)="onActivate($event)"></router-outlet>
</main>
1.
activate
이벤트를 달아줍니다. 페이지가 이동할 때 마다 activate 되겠죠?
2. ViewChild 로 핸들링 하기 위해 #container
@ViewChild('container') containerRef!: ElementRef<HTMLElement>;
onActivate(e: any) {
this.containerRef.nativeElement.scrollTo({ top: 0, behavior: 'smooth' });
}
3. scrollTo 메소드를 활영하여 해당 좌표로 이동합니다. top:0
4. behavior 옵션을 활용하여 smooth 하게 이동합니다.
반응형
LIST