Skip to content

Instantly share code, notes, and snippets.

@joychetry
Created April 12, 2020 20:12
Show Gist options
  • Save joychetry/350e4534404a354f0ef2a306fcdd8319 to your computer and use it in GitHub Desktop.
Save joychetry/350e4534404a354f0ef2a306fcdd8319 to your computer and use it in GitHub Desktop.
Hide Sticky Header on Scroll Down / Show on Scroll Up Elementor
//Set Element ID to "stickycrowwwn"
<script>
document.addEventListener('DOMContentLoaded', function() {
jQuery(function($){
var mywindow = $(window);
var mypos = mywindow.scrollTop();
mywindow.scroll(function() {
if (mypos > 40) {
if(mywindow.scrollTop() > mypos) {
$('#stickycrowwwn').addClass('crowwwnup');
} else {
$('#stickycrowwwn').removeClass('crowwwnup');
}
}
mypos = mywindow.scrollTop();
}); }); });
</script>
<style>
#stickycrowwwn{
-webkit-transition: transform 0.34s ease;
transition : transform 0.34s ease;
}
.crowwwnup{
transform: translateY(-65px); /*adjust this value to the height of your header*/
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment