• Resolved FSAviator

    (@fsaviator)


    Hello!

    Is it possible to make the bar with logo and menu sticky so that it stays at its position while scrolling down? That would be very nice!

    Thanks a lot.

    Best Regards,

    Sascha

Viewing 1 replies (of 1 total)
  • Hi..

    Please make child theme directory and create a functions.php and style.css file.

    Now copy below code and paste into style.css file of child theme’s directory.

    @media (min-width:768px){
    	.sticky-header{
    	position:fixed !important;
    	z-index:999 !important;
    	top:0;
    }
    }

    Also copy below code and paste into functions.php file of child theme’s directory.

    add_action( 'wp_footer', 'sticky_header' );
    function sticky_header(){
    	?>
    	<script>
    	jQuery(document).ready(function () {
    	jQuery(window).scroll(function () {
    	  if (jQuery(this).scrollTop() > 150) {
    	    jQuery('.main-header').addClass('sticky-header');
    	     } else {
    		jQuery('.main-header').removeClass('sticky-header');
    		  }
    		});
    	});
    	</script>
    	<?php
    }

    Save the changes.

    Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Sticky Menu’ is closed to new replies.