Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1465440

    I would like my full-width sub-menu to replace the main header rather than stick to the bottom of it (push it up so to speak).

    Is this possible?

    Any help you can provide would be greatly appreciated.

    -James

    #1465464

    Hey James,

    Thank you for the inquiry.

    Would you like to completely disable the header? If yes, try editing the page and set the Layout > Header visibility and transparency option to the last option, Hide header on this page.

    Best regards,
    Ismael

    #1465694

    Thank you, Ismael for your comment. This isn’t exactly what I had in mind but it got the juices flowing.

    I ended up writing a script that removes the header on scroll. If anyone else is interested in doing so, just paste this into your child’s PHP file. Of note, I am only applying this to the homepage and desktop devices.

    /* FADE HEADER BASED ON SCROLL DEPTH */
    
    function add_hide_header() {
        if (is_front_page()) { // Check if it's the homepage
            ?>
            <script>
                jQuery(window).scroll(function(){
                    if (window.innerWidth > 1024) { // Only apply on screens wider than 1024px (desktop)
                        var scrollTop = jQuery(this).scrollTop();
    
                        // Fade out the header when scroll depth is more than 1px
                        if (scrollTop > 1) {
                            jQuery('#header_main').fadeOut(500); // at a speed of .5 seconds
                        } 
                        // Fade in the header when scroll depth is less than 200px
                        else if (scrollTop < 200) {
                            jQuery('#header_main').fadeIn(500); // at a speed of .5 seconds
                        }
                    }
                });
            </script>
            <?php
        }
    }
    add_action('wp_footer', 'add_hide_header');

    You can close this case.

    I appreciate your help.

    -James

    #1465730

    Hi,

    Great, I’m glad that you found a solution and thanks for sharing. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Have sub menu replace header’ is closed to new replies.