"Header Script - On scroll up header sticky header show"
Bootstrap 4.1.1 Snippet by anmolv886

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Create your snippet's HTML, CSS and Javascript in the editor tabs</h2> </div> </div>
jQuery(function() { var $window = jQuery(window); var lastScrollTop = 0; var $header = jQuery('.sticky-header-dp'); var headerHeight = $header.outerHeight(); $window.scroll(function() { var windowTop = $window.scrollTop(); if ( windowTop >= headerHeight ) { jQuery('.page-header').addClass( 'sticky' ); } else { jQuery('.page-header').removeClass( 'sticky' ); jQuery('.page-header').removeClass( 'ox-sticky sticky-fixed' ); } if ( jQuery('.page-header').hasClass( 'sticky' ) ) { if ( windowTop < lastScrollTop ) { jQuery('.page-header').addClass( 'ox-sticky sticky-fixed' ); } else { jQuery('.page-header').removeClass( 'ox-sticky sticky-fixed' ); } } lastScrollTop = windowTop; } ); });

Related: See More


Questions / Comments: