2017-04-14 68 views
0

我想在我的Ionic2應用程序中添加動畫滾動,但我無法在滾動上添加類,因此滾動時不會發生動畫,所有動畫都會一次被觸發。 請幫我解決這個問題。如何在ionic2上滾動添加類

回答

0

基本上有一個ionScroll事件發射器可用於ion-content,所以你可以訂閱它並做任何你需要的。您可以在docs中找到更多信息。

下面是一個例子:

template.html

<ion-content #content></ion-content> 

component.js

import { Component, ViewChild } from '@angular/core' 

@Component({...}) 
export class Component { 
    @ViewChild('content') content = null 

    ngAfterViewInit() { 
    this.content.ionScroll.subscribe(event => { 
     // do what you need here 
     console.log(event) 
    }) 
    } 
} 
+0

先生感謝你的答覆,但我想在每一個部分的動畫這樣的[鏈接] (http://codepen.io/syedrafeeq/full/yEJKn/)。 –