jQuery Ajax load images problem
- by jackysee
I have a code that would call $.load() to get an HTML fragment. In the fragment there will be a list of images and a script that would do some calculation based on the list size. The fragment looks like
<div>
<ul>
<li><img .../></li>
<li><img .../></li>
...
</ul>
</div>
<script>
//... script to do calculation on the list width
</script>
Originally, I use css's max-width to ensure that the image would not exceed 180px. But as IE has no max-width, I use the expression hack. However, it seems when the image are first load, the script cannot get a correct width of image list. Seems like the script load earlier than the CSS expression.
If it is a new page, I can certainly call $(window).load() to ensure all the images are loaded. But what can I do in an ajax html fragment request?