【发布时间】:2017-04-17 16:02:49
【问题描述】:
我想在我的 Ionic2 应用程序中添加滚动动画,但我无法在滚动中添加类,因此动画不会在滚动时发生,所有动画都会同时触发。 请帮我解决这个问题。
【问题讨论】:
标签: typescript ionic2
我想在我的 Ionic2 应用程序中添加滚动动画,但我无法在滚动中添加类,因此动画不会在滚动时发生,所有动画都会同时触发。 请帮我解决这个问题。
【问题讨论】:
标签: typescript ionic2
基本上ion-content 上提供了一个ionScroll 事件发射器,因此您可以订阅它并做任何您需要的事情。您可以在docs 中找到更多信息。
这是一个例子:
模板.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)
})
}
}
【讨论】: