jquery .load() doesn't work after hard refresh for some reason
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5323042/jquery-load-doesnt-work-after-hard-refresh">jquery .load() doesn&#39;t work after hard refresh</a>  </p>
</blockquote>



<p>I have some code that when the page loads gets the height of an image and then resizes its container div accordingly. This works fine unless its the first time the page has been loaded or i do a hard refresh with ctrl + f5, then it doesn't work. I have tried using</p>

<pre><code>$('#div img').load(function() {
// put the code here
});
</code></pre>

<p>But I get the same problem. Anyone know why this is happening?</p>

<p>This is my code:</p>

<pre><code>$(document).ready(function() {
   maxheight = 0;
   $('#venue #main-img img').each(function() {
      height = $(this).height();
      if(height &gt; maxheight) {
         maxheight = height;
      }
      $(this).hide();
  });
  $('#venue #main-img').animate({ height: maxheight });
  $('#venue #main-img img').first().show();
});
</code></pre>
