Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to fix header on scroll

as per https://sigmascripts.com/how-to-fix-header-on-scroll/ 

<div id="header" class="big_header"> <p>TalkersCode Sticky Header</p> </div>

<script>
$(window).scroll(function()
 {
 if ($(this).scrollTop() > 1)
 {
 $('#header').addClass("sticky_header");
 }
 else
 {
 $('#header').removeClass("sticky_header");
 }
 });
</script>
 
PREVIOUS NEXT
Tagged: #fix #header #scroll
ADD COMMENT
Topic
Name
2+5 =