Created
October 23, 2019 09:12
-
-
Save DiviThemeExamples/4157272a6bde0707141d1ffa4867296e to your computer and use it in GitHub Desktop.
Make Divi Theme Builder header sticky
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// When the user scrolls down 50px from the top of the document, resize the header's font size | |
window.onscroll = function() {scrollFunction()}; | |
function scrollFunction() { | |
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) { | |
document.getElementById("myheader").style.position = "fixed"; | |
} else { | |
document.getElementById("myheader").style.position = ""; | |
} | |
} | |
</script> | |
// tutorial @ https://www.divithemeexamples.com/make-your-divi-4-0-header-sticky-or-fixed-with-the-theme-builder/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment