Skip to content

Commit e67df43

Browse files
Merge pull request #39410 from aireilly/fix-footer-overlap-welcome-page
fixes footer overlap on welcome page
2 parents 9258da9 + caf3347 commit e67df43

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

_templates/_page_openshift.html.erb

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -442,24 +442,52 @@
442442
toc = document.querySelector('#toc')
443443
main = document.querySelector('.main')
444444
okd_footer = document.querySelector('.footer-origin-docs')
445+
446+
//handle short pages
447+
if (window.innerHeight === document.documentElement.scrollHeight) {
448+
//sidebar
449+
if (sidebar !== null && okd_footer == null) {
450+
sidebar.style.marginBottom = "38px";
451+
main.style.marginBottom = "35px";
452+
};
453+
//okd sidebar
454+
if(sidebar !== null && okd_footer !== null) {
455+
sidebar.style.marginBottom = "176px";
456+
main.style.marginBottom = "135px";
457+
}
458+
};
459+
460+
//handle scrolling pages
445461
document.addEventListener('scroll', () => {
446462
//scroll to bottom
447463
if (window.innerWidth >= 1008) {
448-
if(sidebar !== null && toc !== null) {
464+
if(sidebar !== null) {
465+
//pages with multiple toc entries
449466
if(document.documentElement.scrollHeight === window.pageYOffset + window.innerHeight) {
450-
sidebar.style.marginBottom = "38px";
451-
toc.style.bottom = "35px";
452-
main.style.marginBottom = "35px";
453-
//okd footer
454-
if(okd_footer !== null) {
467+
//sidebar
468+
if (sidebar !== null && okd_footer == null){
469+
sidebar.style.marginBottom = "38px";
470+
main.style.marginBottom = "35px";
471+
};
472+
//toc
473+
if (toc !== null && okd_footer == null){
474+
toc.style.bottom = "35px";
475+
};
476+
//okd sidebar
477+
if(sidebar !== null && okd_footer !== null) {
455478
sidebar.style.marginBottom = "176px";
456-
toc.style.bottom = "175px";
457479
main.style.marginBottom = "135px";
458480
};
481+
//okd toc
482+
if (toc !== null && okd_footer !== null){
483+
toc.style.bottom = "175px";
484+
};
459485
};
460486
if(document.documentElement.scrollHeight != window.pageYOffset + window.innerHeight) {
461487
sidebar.style.marginBottom = "0px";
462-
toc.style.bottom = "0px";
488+
if (toc !== null) {
489+
toc.style.bottom = "0px";
490+
}
463491
}
464492
}
465493
}

0 commit comments

Comments
 (0)