guardian/mobile-apps-article-templates — pull request #287 by jglueck (2014-09-12 16:18:57+00:00)
Title: Gia 3133

Fixed gallery layout after rotation in slideshow/enlarged picture (native) view. --

collagePlus is the plugin that lays out the gallery according to available space in either portrait or landscape views and is initialised when first viewing the page and on orientation change. With iOS there is a native overlay above the gallery and although the onorientationchange function is still triggered behind the scenes when in the slideshow/gallery view, it calculates the layout for the image gallery based on the previous orientation that was in view.

This fix includes a new native trigger when the slideshow is closed called redrawGallery that tells collagePlus the orientation change type (var called mode). In the collagePlus plugin if the orientation var is passed into the init function then the initial width called albumWidth gets a new calculated value depending on whether orientation is landscape or portrait. This overrides the calculated clientWidth (which is default behaviour when there is no overlay) and therefore forces the last known view and dimensions, fixing the problem.