title: jQuery loading order in Wordpress
body: <p>I have a jQuery script that reads img height and adds style tag to head tag.</p>
  
  <p>jQuery</p>
  
  <pre><code>var img = document.getElementById('logomini');  
  height = img.clientHeight;
  
  $(function (){
      $("&lt;style type='text/css' id='style1'&gt;#menu ul { line-height: "+ height +"px }&lt;/style&gt;").appendTo("head");
  });
  </code></pre>
  
  <p>The problem: sometimes the script is working properly and sometimes it's not. When I'm refreshing my website (Wordpress) the line-height is 80px or 0px. I think it's a problem with script loading. When script is loading faster than img it showing 0px. But it's only my guess... The script tag is right before <code>&lt;/body&gt;</code> tag.</p>
  
  <p><a href="http://s592293456.websitehome.co.uk/demos/" rel="nofollow">my demo page</a></p>
  
  <p>Any ideas?</p>