Created
April 12, 2020 20:12
-
-
Save joychetry/350e4534404a354f0ef2a306fcdd8319 to your computer and use it in GitHub Desktop.
Hide Sticky Header on Scroll Down / Show on Scroll Up Elementor
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
//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