I've moved this to bug reports since its reproducible on the official demo page, just as you say. It also happens in IE 9 on Windows 7 if you view it in the IE 7 or IE 8 modes.
There's an easy fix though. Find this section in the simplegallery.js script (around line #41):
Code:
for (var i=0; i<setting.imagearray.length; i++){ //preload slideshow images
preloadimages[i]=new Image()
preloadimages[i].src=setting.imagearray[i][0]
if (setting.imagearray[i][3] && setting.imagearray[i][3].length>setting.longestdesc.length)
setting.longestdesc=setting.imagearray[i][3]
jQuery(preloadimages[i]).bind('load error', function(){
loadedimages++
if (loadedimages==setting.imagearray.length){
dfd.resolve() //indicate all images have been loaded
}
})
}
Move it up a little like so:
Code:
for (var i=0; i<setting.imagearray.length; i++){ //preload slideshow images
preloadimages[i]=new Image()
jQuery(preloadimages[i]).bind('load error', function(){
loadedimages++
if (loadedimages==setting.imagearray.length){
dfd.resolve() //indicate all images have been loaded
}
})
preloadimages[i].src=setting.imagearray[i][0]
if (setting.imagearray[i][3] && setting.imagearray[i][3].length>setting.longestdesc.length)
setting.longestdesc=setting.imagearray[i][3]
}
The key is to bind the onload/onerror code to the image before the src is assigned. What was happening was that, with everything cached the load event was firing before the behavior for it was bound. With this new order to the code that cannot happen.
Bookmarks