Oh. I think I see now. The size of the frames can change, so you have to call reset on them all here.  Maybe you should modify resizeHandler() in gallery.js to call resetFrames().

Actually, maybe you can rename resetFrames() to resizeFrames() to better indicate what it is for.  And maybe add a comment :-)