adjust scrollToElement to account for fixed merge request tabs
This commit is contained in:
parent
c434568f37
commit
54a794f2df
1 changed files with 7 additions and 5 deletions
|
@ -135,12 +135,14 @@
|
||||||
|
|
||||||
scrollToElement(container) {
|
scrollToElement(container) {
|
||||||
if (location.hash) {
|
if (location.hash) {
|
||||||
const navBarHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight() + document.querySelector('.js-tabs-affix').offsetHeight;
|
const offset = 0 - (
|
||||||
|
$('.navbar-gitlab').outerHeight() +
|
||||||
|
$('.layout-nav').outerHeight() +
|
||||||
|
$('.js-tabs-affix').outerHeight()
|
||||||
|
);
|
||||||
const $el = $(`${container} ${location.hash}:not(.match)`);
|
const $el = $(`${container} ${location.hash}:not(.match)`);
|
||||||
if ($el.length) {
|
if ($el.length > 0) {
|
||||||
$.scrollTo($el[0], {
|
$.scrollTo($el[0], { offset });
|
||||||
offset: -navBarHeight,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue