-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathcontent-adapter.ts
34 lines (27 loc) · 920 Bytes
/
content-adapter.ts
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
32
33
34
import { IonAffixContainer } from '../ion-affix-container';
import { Content } from 'ionic-angular';
import { Observable, merge } from 'rxjs';
/**
* Adapter for ion-content.
*
* @author Jonas Zuberbuehler <[email protected]>
*/
export class ContentAdapter implements IonAffixContainer {
constructor(public content: Content) {
}
onScroll(): Observable<any> {
return merge(this.content.ionScrollStart, this.content.ionScroll, this.content.ionScrollEnd);
}
getClientTop(): number {
return this.content.getScrollElement().getBoundingClientRect().top;
}
getScrollTop(): number {
return this.content.getScrollElement().scrollTop;
}
appendFixedHeader(headerElement: any): void {
this.content.getNativeElement().appendChild(headerElement);
}
isScrollingDown(): boolean {
return this.content.directionY === 'down';
}
}