Skip to content

Commit

Permalink
Use full viewport width as default width if we don't yet know the wid…
Browse files Browse the repository at this point in the history
…th of the image.
  • Loading branch information
hennikul committed Jan 30, 2015
1 parent c96cea8 commit 799216b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/galleria.js
Original file line number Diff line number Diff line change
Expand Up @@ -4908,7 +4908,12 @@ this.prependChild( 'info', 'myElement' );
// Set srcset in img tag for responsive retina images.
if (data.srcset) {
$( image.image ).attr( 'srcset', data.srcset );
$( image.image ).attr( 'sizes', image.width+"px" );
if (image.width) {
$( image.image ).attr( 'sizes', image.width+"px" );
} else {
// We don't know the size of the image yet, but it can't be wider than the viewport
$( image.image ).attr( 'sizes', "100wv" );
}
}

self.trigger($.extend(evObj, {
Expand Down

0 comments on commit 799216b

Please sign in to comment.