Hello all,

I made myself this photo album. Upon clicking an image, it will get surrounded by <br>'s and enlarge itself. The location is then set to it's #id, to scroll to it. I observe a bug: When I select the next image, then sometimes it scrolls below it. The reason, as I diagnosed it, is that when the next image is pushed down by the current one, then the changes to the layout performed by the onclick function take place after the scrolling, so the scrolling is done to the wrong coordinate.

How could I fix this?

P.S. Sometimes it just works OK... I don't know exactly how to reproduce the bug.