lokesh / lightbox2

THE original Lightbox script (v2).
http://lokeshdhakar.com/projects/lightbox2/
MIT License
6.22k stars 1.77k forks source link

The first number of albumLabel will be wrong in IE 8 #555

Closed objectG closed 7 years ago

objectG commented 7 years ago

The version of jquery is 1.8.x. In IE 8 , when I click the next button, the number of current image will be wrong. It seems that the 'currentImageIndex' will be recalculate from 0 in IE 8, but it will be calculate from 1 in IE 9+ or other browsers, since it has been executed once when the first image is loading.

lokesh commented 7 years ago

Thank you for reporting the bug but since IE 8's browser share has continued to shrink and Microsoft itself has discontinued support for the browser I am going to update the Lightbox browser support policy to drop IE 8. Sorry for the inconvenience but this will make maintenance and testing easier.

objectG commented 7 years ago

Thank you very much.

objectG commented 7 years ago

I have found the reason. In the function changeImage. you put the 'this.currentImageIndex = imageNumber;' at last. However, the function 'onload' will set the indexof currentImage before the currentImageIndex being chagned. The execute order is different between ie 8 and other browsers.

After I put the 'this.currentImageIndex = imageNumber;'on the front of the 'var preloader = new Image();', it runs well in ie 8.