Skip to content

Commit 5ffd139

Browse files
authored
Merge pull request #73613 from aireilly/add-footer-transition
OCPBUGS-17161 - hide footer after a few seconds
2 parents a1483ec + aca1e92 commit 5ffd139

File tree

1 file changed

+15
-59
lines changed

1 file changed

+15
-59
lines changed

_templates/_page_openshift.html.erb

Lines changed: 15 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<link href="https://assets.openshift.net/content/subdomain/touch-icon-precomposed.png" rel="apple-touch-icon-precomposed" type="image/png"/>
2121
<link href="https://assets.openshift.net/content/subdomain/favicon32x32.png" rel="shortcut icon" type="text/css"/>
2222
<link href="https://assets.openshift.net/content/osh-nav-footer.css" rel="stylesheet" type="text/css" media="screen"/>
23-
<link href="https://docs.openshift.com/container-platform/4.1/_stylesheets/docs.css" rel="stylesheet" media="screen"/>
23+
<link href="https://file.emea.redhat.com/aireilly/add-footer-transition/_stylesheets/docs.css" rel="stylesheet" media="screen"/>
2424
<link href="https://docs.openshift.com/container-platform/4.1/_stylesheets/print.css" rel="stylesheet" type="text/css" media="print"/>
2525
<!--[if IE]><link rel="shortcut icon" href="https://assets.openshift.net/content/subdomain/favicon.ico"><![endif]-->
2626
<!-- or, set /favicon.ico for IE10 win -->
@@ -718,64 +718,6 @@
718718
})
719719
</script>
720720

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

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

0 commit comments

Comments
 (0)