(aos)로 스크롤 할 때 뷰에 애니메이션 요소를 적용하기위한 라이브러리가 있지만 사용을위한 angle2 바인딩이없는 것 같습니다. 누군가 angular2 내에서 이와 같은 것을 달성하는 방법을 알고 있습니까, 아니면 적어도 angular2 내에서 작동하도록 AOS를 구성합니까? (버전을 의미 2+) 꽤 쉽게 응용 프로그램에 어떤 제 3 자 JS 라이브러리를 포함 할 수angular2로 스크롤 할 때 애니메이션보기
1
A
답변
1
각도 어떤 도움
감사합니다. 나는 다음 단계에 따라 각도 4 일 aos
를 얻을 수있었습니다 :
면책 조항 : 당신은
@angular/animations
를 사용하여 동일한 또는 더 나은 달성 할 수있을 수 있지만, 당신은aos
(또는 제 3 자 라이브러리를 사용하려는 경우)를 입력하면이를 수행하는 방법이 표시됩니다.aos
ng new angular-aos-app
설치 : npm i --save aos
가
aos
을 포함npm i -g @angular/cli
새로운 각도 응용 프로그램을 만듭니다 는 https://angular.io/guide/animations
- 이 각도 CLI를 설치 방문,
@angular/animations
를 사용하는 방법에 대한 자세한 내용은 CSS in.angular-cli.json
:{ ... "apps": [ { ... "styles": [ "styles.css", "../node_modules/aos/dist/aos.css" ], ... } ] ... }
와이어 최대
aos
각도의 의존성 삽입 (Dependency Injection) 시스템을 통해 : 구성 요소에// aos.ts import * as animateOnScroll from 'aos'; import { InjectionToken } from '@angular/core'; export const aos = animateOnScroll; // This makes it possible to refer to AOS in Angular, see below export const AosToken = new InjectionToken('AOS');
// app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AosToken, aos } from './aos'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule ], providers: [ //register AOS with DI { provide: AosToken, useValue: aos } ], bootstrap: [ AppComponent ] }) export class AppModule { }
를 주입
aos
는 ://app.component.ts import { Component, Inject } from '@angular/core'; import { AosToken } from './aos'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'app'; //use the injection token to inject into your constructor constructor(@Inject(AosToken) aos) { aos.init(); //you can now use it, although you may want to do this onInit instead } }
은 HTML 일부
aos
애니메이션을 추가<ul data-aos="slide-left">
<div style="text-align:center"> <h1> Welcome to {{title}}!! </h1> </div> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <h2>Here are some links to help you start: </h2> <ul data-aos="slide-left"><!-- animate this list when you scroll down --> <li> <h2><a target="_blank" href="https://angular.io/tutorial">Tour of Heroes</a></h2> </li> <li> <h2><a target="_blank" href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></h2> </li> <li> <h2><a target="_blank" href="http://angularjs.blogspot.ca/">Angular blog</a></h2> </li> </ul>
+0
Angular 4.4.6에서 https를 사용하지 않습니다. : //stackoverflow.com/questions/47253364/integrate-aos-library-with-angular4-application –
관련 문제
- 1. CALayer와 애니메이션보기 스크롤
- 2. ListView의 애니메이션보기
- 3. 애니메이션보기
- 4. 애니메이션보기
- 5. 애니메이션보기
- 6. 애니메이션보기 추가
- 7. Swift UICollectionViewCell 스크롤했을 때 무작위로 빈 애니메이션보기
- 8. 형제 애니메이션보기
- 9. 스크롤 할 때 부드러운 스크롤
- 10. Android에서 애니메이션보기
- 11. GIF 애니메이션보기
- 12. 서브 뷰에서 뷰를 추가/제거 할 때 애니메이션보기
- 13. jquery에서 아래로 스크롤 할 때 스크롤 할 때 뭔가를 수행하십시오.
- 14. UIButton 애니메이션보기
- 15. QML 애니메이션보기
- 16. 아래쪽 탐색 라이브러리 v25.0.0 애니메이션보기?
- 17. 스크롤 할 때 뒤처짐
- 18. 스크롤 할 때 이미지로드
- 19. 아래로 스크롤 할 때
- 20. 스크롤 할 때 div를
- 21. 사용자가 angular2로 목록 요소를 클릭 할 때 동영상을 동적으로 재생하려고합니다.
- 22. 하위 디렉토리의 앱으로 라우팅 할 때 URL이 Angular2로 증가합니다.
- 23. 안드로이드 갤러리 애니메이션보기 무효
- 24. 페이지가 스크롤 할 때 모달 스크롤
- 25. 맨 위로 스크롤 할 때 아래로 스크롤
- 26. 스크롤 할 때 스크롤 뷰의 내용이 변경됩니다.
- 27. 아래로 스크롤 할 때 DIV를 아래로 스크롤
- 28. 두 번째 스크롤 할 때 RecyclerView 스크롤
- 29. 아래로 스크롤 할 때 스크롤 위치입니다. jquery
- 30. div에서 스크롤 할 때 스크롤 페이지
어쩌면이 도움이 https://stackoverflow.com/a/44921710/5155810에게의 –
가능한 중복이다 각도 4 - 사업부가 뷰포트에 올 때 애니메이션을 트리거하는 방법?] (HTTPS : //stackoverflow.com/questions/43573489/angular-4-how-to-trigger-an-animation-when-a-div-comes-into-the-viewport) – Nofel