Willy Lee
Willy Lee

Reputation:

Something wrong with the way the site loads

I own a small blog and recently random people have been telling me that my site has loading problems as in the site will load but only pictures will show and not the text. I've never encountered the problem personally myself until today. I see what they mean, and if I hover my mouse over the text, then the text loads as well. Anybody have a clue on why?

Upvotes: 0

Views: 34

Answers (1)

user48752
user48752

Reputation: 317

If it's happening only with Google Chrome, then it might be due to Google font's not rendering properly. Use this code in your style.css to fix the issue.

body {
    -webkit-animation-delay: 0.1s;
    -webkit-animation-name: fontfix;
    -webkit-animation-duration: 0.1s;
    -webkit-animation-iteration-count: 1;
    -webkit-animation-timing-function: linear;
}

@-webkit-keyframes fontfix {
    from { opacity: 1; }
    to   { opacity: 1; }
}

Sometimes, it didn't work too so the it'll be good by adding this code in your header.php file:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">


 $(function() { $('body').hide().show(); });
</script>




<script type="text/javascript">

//JavaScript goes here



WebFontConfig = {
  google: { families: ['FontOne', 'FontTwo'] },
    fontinactive: function (fontFamily, fontDescription) {
   //Something went wrong! Let's load our local fonts.
    WebFontConfig = {
      custom: { families: ['FontOne', 'FontTwo'],
      urls: ['font-one.css', 'font-two.css']
    }
  };
  loadFonts();
  }
};


function loadFonts() {
  var wf = document.createElement('script');
  wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
    '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
  wf.type = 'text/javascript';
  wf.async = 'true';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(wf, s);
}


(function () {
  //Once document is ready, load the fonts.
  loadFonts();
  })();


</script>

I hope this helps

Upvotes: 1

Related Questions