Skip to content

Commit 234f999

Browse files
committed
Add footer transition
hide footer after a few seconds when it is scrolled to
1 parent a20ad4a commit 234f999

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
@@ -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')
@@ -803,5 +745,19 @@
803745
})
804746
</script>
805747

748+
<!-- hide footer after 3 seconds -->
749+
<script type="text/javascript">
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+
})
761+
</script>
806762
</body>
807763
</html>

0 commit comments

Comments
 (0)