connecting the gallery transitions