What I'm doing is creating a photo gallery of sorts, where i basically want to supply a total # of images, rows/cols max thumb/full image and let the script do the work. The solution I've opted for is to load the images once and change their size / position / visibility to show "thumb galleries" or "full image size" [and allow for pagination and all the bells & whistles]....
Naturally, the problem relates to the size of the images. When I first load a gallery, I load all the images off screen without height/width specified... I then use the onLoad event of the images to grab the "correct" height/width.
Expand|Select|Wrap|Line Numbers
- function Photo( ... ) {
- ...
- this.element = document.createElement("IMG");
- this.element.onload = callbackFunc( this, "init" );
- ...
- }
- /* callbackFunc is a function I use to let me use "this" inside an event handler
- -- similar to prototype's "bindAsEventListener" for those familiar with it */
- /* _event = Event object; _this = source element (loaded image) */
- Photo.prototype.init = function( _event, _this ) {
- this.width=_this.width;
- this.height=_this.height;
- }
Expand|Select|Wrap|Line Numbers
- this.element = new Image()
anyone else noticed this problem? I saw a post about it on some other forum, but there was no resolution to the problem.