Header will need to be set to sticky and overlay by default.
Simply add this script to your global JS or enque as a seperate script file.
Header will need to be set to sticky and overlay by default.
Simply add this script to your global JS or enque as a seperate script file.
window.onscroll = function(e) { | |
var scrollY = window.pageYOffset || document.documentElement.scrollTop; | |
var header = document.querySelector('header'); | |
var height = -header.clientHeight; | |
header.style.transition = 'transform 0.5s'; | |
(scrollY <= Math.max(this.lastScroll, 300) || window.innerWidth <= 200 || this.loaded === undefined) | |
? header.style.transform = 'translateY(0px)' | |
: header.style.transform = 'translateY(' + height + 'px)'; | |
this.lastScroll = scrollY; | |
this.loaded = true; | |
}; |
Thanks Abby, Small world. Check out some of Zach's gists, he has a great assortment of BB snippets. https://gist.github.com/zackpyle and he created this nice plugin for class management https://github.com/zackpyle/BBClassDropdown
Thank you again for sharing these snippets! I just happened to click on your profile and saw you're in Cinci! I'm up north of Columbus, closer to Cleveland, but still, also an Ohioan. Smallllllll world!