Skip to content

Commit

Permalink
Fix bug incorrectly displaying wide images in FF
Browse files Browse the repository at this point in the history
This bug occured because of the interaction between flex-box on the
surrounding container and min-width/max-width. Setting the flex-basis
property on the image leads to the image correctly picking up
width/height again.

See also:
philipwalton/flexbugs#138
  • Loading branch information
Maximilian Seitzer committed Feb 13, 2017
1 parent 43993c0 commit 4cb4024
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/static/scripts/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ $('#image').on('load', function() {
});
}, 0);
if(img.naturalWidth < img.naturalHeight) {
$(this).css({'min-width': '', 'max-width': '',
$(this).css({'min-width': '', 'max-width': '', 'flex-basis': '',
'min-height': '100%', 'max-height': '100%'});
} else {
$(this).css({'min-height': '', 'max-height': '',
$(this).css({'min-height': '', 'max-height': '', 'flex-basis': '100%',
'min-width': '100%', 'max-width': '100%'});
}
$('#text_image_size').text("WxH: " +
Expand Down

0 comments on commit 4cb4024

Please sign in to comment.