-
AuthorPosts
-
August 26, 2024 at 5:55 pm #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
August 27, 2024 at 6:31 am #1465464Hey 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,
IsmaelAugust 29, 2024 at 7:46 pm #1465694Thank 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
August 30, 2024 at 9:44 am #1465730Hi,
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 -
AuthorPosts
- The topic ‘Have sub menu replace header’ is closed to new replies.