Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit e6cace0

Browse files
committed
ANCHOR SCROLL: WIP - feat($anchorScroll): add support for configurable
scroll offset Updated the `scrollTo` function to prevent elements near the bottom of the scrolled element to be scrolled further down than required.
1 parent 78fa18a commit e6cace0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ng/anchorScroll.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ function $AnchorScrollProvider() {
152152
if (elem) {
153153
elem.scrollIntoView();
154154
var offset = scrollOffsetGetter();
155-
if (offset) {
156-
$window.scrollBy(0, -1 * offset);
155+
var actualOffset = offset && (offset - (elem.offsetTop - document.body.scrollTop));
156+
if (actualOffset) {
157+
$window.scrollBy(0, -1 * actualOffset);
157158
}
158159
} else {
159160
$window.scrollTo(0, 0);

0 commit comments

Comments
 (0)