Skip to content

Commit

Permalink
Merge pull request #444 from brcontainer/patch-1
Browse files Browse the repository at this point in the history
Firefox returns empty in `.css()`
  • Loading branch information
jasny committed Jun 8, 2016
2 parents e5c67d1 + 6191dad commit feea0e5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
10 changes: 9 additions & 1 deletion dist/js/jasny-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,15 @@ if (typeof jQuery === 'undefined') { throw new Error('Jasny Bootstrap\'s JavaScr
element.find('.fileinput-filename').text(file.name)

// if parent has max-height, using `(max-)height: 100%` on child doesn't take padding and border into account
if (preview.css('max-height') != 'none') $img.css('max-height', parseInt(preview.css('max-height'), 10) - parseInt(preview.css('padding-top'), 10) - parseInt(preview.css('padding-bottom'), 10) - parseInt(preview.css('border-top'), 10) - parseInt(preview.css('border-bottom'), 10))
if (preview.css('max-height') != 'none') {
var mh = parseInt(preview.css('max-height'), 10) || 0
var pt = parseInt(preview.css('padding-top'), 10) || 0
var pb = parseInt(preview.css('padding-bottom'), 10) || 0
var bt = parseInt(preview.css('border-top'), 10) || 0
var bb = parseInt(preview.css('border-bottom'), 10) || 0

$img.css('max-height', mh - pt - pb - bt - bb)
}

preview.html($img)
element.addClass('fileinput-exists').removeClass('fileinput-new')
Expand Down

0 comments on commit feea0e5

Please sign in to comment.