- var imgelem = new Element('img', { 'src': this.src });
- imgelem.inject($(this.id));
Hello everyone,
I'am working on a script which 'popups' images as an overlay. Nothing special, nothing new - just simple stuff.
But i stuck with finding a appropriate way to preload the image.
The image object itself and the div container around stays the same way all the time (internally). It will just be shown or hidden, or repositioned by scroll or resize events.
So if someone clicks on a thumbnail, he calls a function that is fading the background, changing the url of the image object and then displays (and position) the container. Problem is - without having the picture completely loaded, positioning will fail.
Therefore I need some kind of event which will wait until the image object (after changing the url) is fully loaded and then calls the 'show' function. I've tried many different approaches, using JS internal onload Event, addEvent from MooTools Core, Asset.image from MooTools More, and so on. Nothing has really worked. So don't get me wrong, i don't want to load a bunch of images, I just want to ensure that a specific image object is loaded before it will be shown.
Thanks!


