Hi! I have the following task: I have a list of images and some of those images have a larger version that I want to display in a popup when clicking on them. As I want to generate those Popup-Links automatically I need to know the size of the large image. I do this by loading the large image into the list (without showing), getting it's height & passing it on to the function generating the popup. Of course the (hidden) image has to be fully loaded for this. I try to wait for that by using $('.myimage').ready(function(){actions go here}), but somehow it won't wait (and returns dimensions of 0x0). As soon as my browser has cached the images everything works fine. Any idea how to get the function wait for the image to load?
Code goes like this: function popup(pfad){ var hoehe = 0; var breite = 0; $('.asset:visible').append('<img class="sizeCheck" "src="'+pfad+'" style="display:none">'); $('.sizeCheck').ready(function(){ $('.sizeCheck').each(function(){ hoehe = this.height; breite = this.width; }); $('.sizeCheck').remove(); var Grossansicht = window.open(pfad,'Grossansicht','width='+breite +',height='+hoehe+',top=20,left=20'); Grossansicht.document.write('<html><head><style type="text/css">body, html{margin: 0 0 0 0; padding: 0 0 0 0;}</style></head><body><img src="'+pfad+'"></body>'); Grossansicht.focus(); }); Thanks alot in advance!