jQuery(window).load(function() {
jQuery.each(jQuery(".extraimgs"), function() {
//this.height = 0 and this.width=0 in IE only
if (this.height > this.width) {
if (this.height > 263) {
this.height = 263;
}
if (this.width > 354) {
this.width = 354;
}
}
else {
this.height = 263;
this.width = 354;
}
});
});
HTML Code
<asp:DataList runat="server" ID="dlImages" RepeatColumns="2" RepeatDirection="Horizontal" RepeatLayout="Table" OnItemDataBound="dlImages_ItemDataBound" Style="display: none;">
<ItemTemplate>
<div>
<asp:Image runat="server" ID="imgPics" class="extraimgs" />
</div>
</ItemTemplate>
</asp:DataList>
I have problem with this code in IE. Here I am setting the height and width of images during runtime (page load event - using jQuery) and source of images using code-behind.
This code works well in all browsers except IE8. In page load event, I get the height and width of the images, but I don't get the height and width of images in IE8. I tried a lot to get height and width of images during load event, but it does not work.
Does anyone know a solution?