Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1218628

    I’m having a problem with the rendering of my header as I build my website’s front page. When I refresh my site’s front page in any browser, there is a split second flicker of the header much wider than the page (screenshot), and then it quickly reverts to the right size (screenshot). As you can see in the screenshots, the flicker’s wide version happens because the menu is initially positioned to the left of the logo instead of below it. Can you please help. I’ve included temporary login credentials in Private Content.

    #1220465

    Hey Gary,
    Sorry for the late reply, and thanks for the screenshot and link, for that split second you are seeing the header before your custom css is loaded:

    .responsive #top #header #header_meta {
        flex-basis: 100%;
    }

    for your “Logo left, Widgets right, menu below” solution.
    So I added this to your child theme functions.php in hopes to load the css before your other css:

    
    function add_custom_css(){
    	?>
    	<style type="text/css">
    		.responsive #top #header #header_meta {flex-basis: 100% !important;}
        </style>
    	<?php
    	}
      add_action('wp_head', 'add_custom_css', 1);

    I also cleared your cache plugin so this would take effect but I think the cache now needs to be re-built to reflect the change, please clear your browser cache and check a few times and let us know if this continues to be an issue.

    Best regards,
    Mike

    #1220727

    Thank you, Mike, for taking a look and making this attempt to fix the problem. Unfortunately, it doesn’t work in any browser for me. Did you try it yourself using the website URL I provided in Private Data? Does it work for you?

    I tried myself a different attempted solution which you can see in functions.php using a FOUC (flash of unstyled content) approach, but that didn’t work either. But maybe that’s a possible worthwhile approach, to somehow make the menu hidden until after all CSS has loaded. I don’t know.

    Any other ideas?

    Thanks,
    Gary

    #1221199

    Hi,
    Thanks for the login, I disabled the script above and tried this solution which seems close but not quite right. I will continue to investigate.

    Best regards,
    Mike

    #1221471

    Thanks, Mike. That’s funny: that’s the exact solution I tried and mentioned above (the “FOUC approach”)–well, Stefan’s solution, not Adam’s (because I don’t know how to do Adam’s inside WordPress), as you can see in my commented out part in functions.php. The investigation continues.

    #1221999

    Hi,
    How about using the preloader at Enfold Theme Options > Page Preloading? I have enabled it and now the preloader shows first and then when the page shows the header is correct. Please clear your browser cache and check.

    Best regards,
    Mike

    #1222451

    Hi Mike!

    Thank you, that does work. But I prefer to keep Page Preloading off, as it looks weird, with the page not loading in pieces like with most websites, but just blank and then it’s all there at once after a time period. If I didn’t find a solution to the FOUC (flash of unstyled content) problem, your Page Preloading solution would have been fine, and I appreciate you finding that solution and giving me that option.

    However, I did end up finding a different, more direct solution today, that also looks better. In my Custom CSS file for my child theme, I hide the main menu:

    .responsive #top #header #header_main .main_menu {
        display: none !important;
    }

    Then in my custom functions.php file for my child theme, I display (unhide) the main menu after the whole page has loaded:

    add_action('wp_head', 'fouc_protect_against');
    function fouc_protect_against () {
      ?>
      <script type="text/javascript">
        jQuery(document).ready(function($) {		            
          $('.main_menu').show();	            
        });  
      </script>
      <?php
    }

    This seems to work satisfactorily! Hooray!

    Speaking of FOUC problems, in case any one else is searching on this problem, I discovered another FOUC issue with the logo, but only in Firefox; all other browsers are fine. There is a FOUC problem in Firefox when loading the logo image: the ALT text displays for a split second before the image displays, giving a FOUC-like flash effect that is ugly. Maybe the problem shows up for every image: I didn’t bother investigating. It only happens in Firefox and is a known bug it turns out. However, a solution like I found for the main menu doesn’t work. But I ended up using the industry accepted solution for this problem, to be added to my Custom CSS file:

    img:-moz-loading {
      visibility: hidden;
    }

    Thanks again, Mike.

    All the best,
    Gary

    #1222464

    Hi,
    Thanks for sharing your solution, this seems to work well. Unless there is anything else we can assist with on this issue, shall we close this then?

    Best regards,
    Mike

    #1222921

    Hi Mike! Yes, you can close this issue. I learned a lot in trying to solve this problem. Thanks again for your help. All the best, Gary

    #1222990

    Hi,
    Glad this is sorted out, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Header displays for a split second too wide (menu positioning issue)’ is closed to new replies.