jQuery Ajax load images problem
Posted
by jackysee
on Stack Overflow
See other posts from Stack Overflow
or by jackysee
Published on 2010-03-13T05:10:19Z
Indexed on
2010/03/13
5:15 UTC
Read the original article
Hit count: 308
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?
© Stack Overflow or respective owner