mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-23 02:40:14 +01:00
project structure update for more accurate import
This commit is contained in:
parent
36288562e6
commit
945cdb7e4f
43 changed files with 47 additions and 42 deletions
|
|
@ -0,0 +1,24 @@
|
|||
import {Directive, Input, Output, EventEmitter, HostListener} from 'angular2/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[scrollPosition]'
|
||||
})
|
||||
export class ScrollPosition {
|
||||
@Input() maxHeight:Number;
|
||||
@Output() scrollChange:EventEmitter<Boolean> = new EventEmitter<Boolean>();
|
||||
|
||||
private _isScrolled:Boolean;
|
||||
|
||||
ngOnInit() {
|
||||
this.onWindowScroll();
|
||||
}
|
||||
|
||||
@HostListener('window:scroll')
|
||||
onWindowScroll():void {
|
||||
let isScrolled = window.scrollY > this.maxHeight;
|
||||
if (isScrolled !== this._isScrolled) {
|
||||
this._isScrolled = isScrolled;
|
||||
this.scrollChange.emit(isScrolled);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue