Skip to content

Commit d7815d6

Browse files
Do not include header height while calculating scroll offset
1 parent 24391cf commit d7815d6

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

app/components/ember-anchor.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export default AnchorComponent.extend({
1212
let elem = $(`[data-${qp}="${qpVal}"]`);
1313
let offset = (elem && elem.offset && elem.offset()) ? elem.offset().top : null;
1414
if (offset) {
15-
const navMenuHeight = $('header').outerHeight();
16-
$(config.APP.scrollContainerSelector).scrollTop(offset - navMenuHeight - 10);
15+
$(config.APP.scrollContainerSelector).scrollTop(offset - 10);
1716
}
1817
}
1918
});

app/mixins/scroll-tracker.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ export default Mixin.create({
1414

1515
didTransition() {
1616
this._super();
17-
let isAnchorEmpty = window && window.location && window.location.search === '?anchor='
18-
if ((typeof FastBoot === 'undefined') && isAnchorEmpty ) {
17+
if ((typeof FastBoot === 'undefined') && window.location.search === '?anchor=' ) {
1918
let elem = $('#methods');
2019
let offset = (elem && elem.offset && elem.offset()) ? elem.offset().top : null;
2120
if (offset) {
22-
const navMenuHeight = $('header').outerHeight();
23-
$(config.APP.scrollContainerSelector).scrollTop(offset - navMenuHeight - 10);
21+
$(config.APP.scrollContainerSelector).scrollTop(offset - 10);
22+
return;
2423
}
25-
} else {
26-
this.get('scrollPositionReset').doReset();
2724
}
25+
this.get('scrollPositionReset').doReset();
2826
}
2927
}
3028
});

0 commit comments

Comments
 (0)