Skip to content

Commit aca1e92

Browse files
committed
hide footer after a few seconds when it is scrolled to
1 parent a9f07bf commit aca1e92

File tree

2 files changed

+12
-70
lines changed

2 files changed

+12
-70
lines changed

_stylesheets/docs.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,6 @@ h2:hover>a.anchor, h2>a.anchor:hover, h3:hover>a.anchor, h3>a.anchor:hover, h4:h
527527
background-color: #000;
528528
padding: 0px 0;
529529
z-index: 5;
530-
transition: transform 0.5s ease-out;
531-
transform: translateY(0);
532530
}
533531

534532
.close-btn-sm {

_templates/_page_openshift.html.erb

Lines changed: 12 additions & 68 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 -->
@@ -717,64 +717,6 @@
717717
})
718718
</script>
719719

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

806748
<!-- hide footer after 3 seconds -->
807749
<script type="text/javascript">
808-
const bottomVisible = () => document.documentElement.clientHeight + window.scrollY >= (document.documentElement.scrollHeight || document.documentElement.clientHeight);
809-
810-
if (bottomVisible()) {
811-
setTimeout(() => {
812-
document.querySelector('footer#rh').classList.add('hide-footer');
813-
}, 3000);
814-
} else {
815-
document.querySelector('footer#rh').classList.remove('hide-footer');
816-
}
750+
const hideFooter = () => {
751+
document.querySelector('footer#rh').style.display = "none";
752+
};
753+
754+
window.addEventListener('scroll', function() {
755+
if (window.innerHeight + window.scrollY >= document.body.offsetHeight) {
756+
setTimeout(hideFooter, 3000);
757+
} else {
758+
document.querySelector('footer#rh').style.display = "block";
759+
}
760+
})
817761
</script>
818762
</body>
819763
</html>

0 commit comments

Comments
 (0)