Recently the need for a custom photo gallery surfaced in one of my GWT pet projects. While such an endeavour seems endless from an artistic point of view, the mechanics behind it – at least for my humble needs – were rather simple:
- the gallery widget will be given a list of image IDs
- for each ID an image element will be created, assigned the image URL and added to the DOM
Surprisingly, this will lead IE 7 to never load any but the first image while the rest will remain in the loading state. A quick test shows that this happens only through DOM manipulation by adding new image elements to the DOM. I found two simple workarounds:
- add each image in a DeferredCommand of its own.
- display a fixed number of images and reuse them. Thus, instead of removing and creating image nodes, leave them on the page and reassign a new URL to them (src attribute)