akveo / akveo/nebular

[Layout] NbLayoutScrollService code example request

オープン
#626 コメント 5 件 リアクション 2 件 担当者 0 名 GitHub で見る
module:theme needs docs needs info
主要言語
TypeScript
スター
8.1k
フォーク
1.5k
PR マージ指標
30日以内にマージされた PR はありません

説明

### Issue type

**I'm submitting a ...** (check one with "x")

* [x] feature request

### Issue description

**Current behavior:**
NbLayoutScrollService documentation is really dry.

**Expected behavior:**
Some code examples would be much appreciated.

**Steps to reproduce:**
- open https://akveo.github.io/nebular/docs/services/layoutscrollservice#nblayoutscrollservice

**Related code:**
I attempted to figure out how it work, but for a newbie it's a bit too much without a guidance. Here is what i thought should work.
```
ngAfterViewChecked(): void {
function getOffset(el) {
const rect = el.getBoundingClientRect();
return {
left: rect.left + window.scrollX,
top: rect.top + window.scrollY
};
}
try {
const pageElement = document.getElementById(this.fragment);
if (pageElement) {
this.scrollService.scrollTo(getOffset(pageElement).left, getOffset(pageElement).top);
this.fragment = '';
}
} catch (e) { }
}
```

**Angular, Nebular**
```
"@angular/core": "6.0.3"
"@nebular/auth": "^2.0.0-rc.10"
"@nebular/security": "^2.0.0-rc.10"
"@nebular/theme": "^2.0.0-rc.10"
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。