Skip to content

Commit 60cccce

Browse files
authored
Merge pull request #73774 from aireilly/add-footer-transition
OCPBUGS-17161 - Hide footer after a few seconds on docs.openshift.com
2 parents 6f0abfa + 234f999 commit 60cccce

File tree

1 file changed

+14
-58
lines changed

1 file changed

+14
-58
lines changed

_templates/_page_openshift.html.erb

Lines changed: 14 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -719,64 +719,6 @@
719719
})
720720
</script>
721721

722-
<!--adjust sidebar and toc when footer is displayed -->
723-
<script type="text/javascript">
724-
sidebar = document.querySelector('.sidebar')
725-
toc = document.querySelector('#toc')
726-
main = document.querySelector('.main')
727-
okd_footer = document.querySelector('.footer-origin-docs')
728-
729-
//handle short pages
730-
if (window.innerHeight === document.documentElement.scrollHeight) {
731-
//sidebar
732-
if (sidebar !== null && okd_footer == null) {
733-
sidebar.style.marginBottom = "38px";
734-
main.style.marginBottom = "35px";
735-
};
736-
//okd sidebar
737-
if(sidebar !== null && okd_footer !== null) {
738-
sidebar.style.marginBottom = "176px";
739-
main.style.marginBottom = "135px";
740-
}
741-
};
742-
743-
//handle scrolling pages
744-
document.addEventListener('scroll', () => {
745-
//scroll to bottom
746-
if ($(window).width() >= 1008) {
747-
if(sidebar !== null) {
748-
//pages with multiple toc entries
749-
if(document.documentElement.scrollHeight === window.pageYOffset + window.innerHeight) {
750-
//sidebar
751-
if (sidebar !== null && okd_footer == null){
752-
sidebar.style.marginBottom = "38px";
753-
main.style.marginBottom = "35px";
754-
};
755-
//toc
756-
if (toc !== null && okd_footer == null){
757-
toc.style.bottom = "35px";
758-
};
759-
//okd sidebar
760-
if(sidebar !== null && okd_footer !== null) {
761-
sidebar.style.marginBottom = "176px";
762-
main.style.marginBottom = "135px";
763-
};
764-
//okd toc
765-
if (toc !== null && okd_footer !== null){
766-
toc.style.bottom = "175px";
767-
};
768-
};
769-
if(document.documentElement.scrollHeight != window.pageYOffset + window.innerHeight) {
770-
sidebar.style.marginBottom = "0px";
771-
if (toc !== null) {
772-
toc.style.bottom = "0px";
773-
}
774-
}
775-
}
776-
}
777-
})
778-
</script>
779-
780722
<!-- adjust alerts on mobile -->
781723
<script type="text/javascript">
782724
alert = document.querySelector('#support-alert')
@@ -805,5 +747,19 @@
805747
})
806748
</script>
807749

750+
<!-- hide footer after 3 seconds -->
751+
<script type="text/javascript">
752+
const hideFooter = () => {
753+
document.querySelector('footer#rh').style.display = "none";
754+
};
755+
756+
window.addEventListener('scroll', function() {
757+
if (window.innerHeight + window.scrollY >= document.body.offsetHeight) {
758+
setTimeout(hideFooter, 3000);
759+
} else {
760+
document.querySelector('footer#rh').style.display = "block";
761+
}
762+
})
763+
</script>
808764
</body>
809765
</html>

0 commit comments

Comments
 (0)