Reset min-width when cloning the element

This commit is contained in:
Fabio Manganiello 2018-05-07 09:57:35 +02:00
parent 19268f66a8
commit e671a1294c

View file

@ -16,13 +16,11 @@ $(document).ready(function() {
var refreshImage = function() { var refreshImage = function() {
var $oldImg = $imgContainer.find('img'); var $oldImg = $imgContainer.find('img');
var $newImg = $imgContainer.find('img').clone() var $newImg = $imgContainer.find('img').clone()
.attr('src', images[processedImages++]) .attr('src', images[processedImages++]).css('min-width', '')
.hide().appendTo($imgContainer); .hide().appendTo($imgContainer);
if ($newImg.width() > $newImg.height()) { if ($newImg.width() > $newImg.height()) {
$newImg.css('min-width', '100%'); $newImg.css('min-width', '100%');
} else {
$newImg.css('min-width', '');
} }
$newImg.on('load', function() { $newImg.on('load', function() {