Custom scroll angular directivesが存在します。私はあなたがより具体的な目的にカスタマイズすることもできると思います。
私はかつてng2-slimscroll使用し、それは私はあなたが機能を追加し、アクションをしたいボタンを管理するために編集できると思います1つののみディレクティブが含まれています。
あなたはその上で、スクロール高さを計算するためにはJavaScript共通機能を使用している気づくとなります。ここでは、barHeightの計算に使用する関数のサンプルを示します。 githubプロジェクトフォルダにあります。 ng2-slimscroll/src/directives/slimscroll.directive.ts
getBarHeight(): void {
setTimeout(() => {
let barHeight = Math.max((this.el.offsetHeight/this.el.scrollHeight) * this.el.offsetHeight, 30) + 'px';
let display = parseInt(barHeight, 10) === this.el.offsetHeight ? 'none' : 'block';
this.renderer.setElementStyle(this.bar, 'height', barHeight);
this.renderer.setElementStyle(this.bar, 'display', display);
this.renderer.setElementStyle(this.grid, 'display', display);
}, 1);
}
出典
2017-05-02 22:16:58
Sam