Lock header area/menu to ALWAYS on top of screen?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8055 Reply

    Jeremy

    Just wondering if there is a way to get the header image and drop down menus to be “locked” at the top of the screen? Would like it to ALWAYS show at the top, even as people are scrolling down through the page, that way they can always see the header logo and the menus to navigate somewhere else.
    Is something like this possible, as I haven’t been able to figure it out.
    Thanks

    #8056

    Ron
    Keymaster

    This is really not how the theme was made but you can force it to act like that. Try the codes below. This could affect other aspects of the theme though.

    Add to child-theme’s functions.php

    add_action( 'frontier_before_container', 'ra_before_container' );
    add_action( 'frontier_after_menu', 'ra_after_menu' );
    
    function ra_before_container() {
    	echo '<div id="fixed-container">';
    }
    
    function ra_after_menu() {
    	echo '</nav></div><nav>';
    }

    Add to child-theme’s style.css

    #fixed-container {
       max-width: 100%;
       position: fixed;
       width: 960px; //Change to your header width
    }
    
    #main {
       margin-top: 205px; //Change to your header height
    }
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Lock header area/menu to ALWAYS on top of screen?
Your information: