Fix #1124 : Rollover pictures lost their ratio

This commit is contained in:
Romain Neutron
2013-03-21 16:05:52 +01:00
parent 2bad0e1398
commit 2ef2666747

View File

@@ -429,8 +429,35 @@
}
}
top -= 10;
height += 20;
if(resizeImgTips)
{
var factor = Math.min((width - 45) / width, (height - 75) / height);
var imgWidth = Math.round(width * factor);
var imgHeight = Math.round(height * factor);
width = imgWidth + 45;
height = imgHeight + 85;
$imgTips.css({
maxWidth: imgWidth,
maxHeight: imgHeight
});
}
if(resizeVideoTips)
{
var factor = Math.min((width - 45) / width, (height - 75) / height);
var imgWidth = Math.round(width * factor);
var imgHeight = Math.round(height * factor);
width = imgWidth + 45;
height = imgHeight + 75;
$videoTips.css({
width: Math.round(imgWidth),
height: Math.round(imgHeight)
});
}
helper.parent.css({
width: Math.round(width),
@@ -439,22 +466,6 @@
top: top
});
if(resizeImgTips)
{
$imgTips.css({
maxWidth: Math.round(width - 50),
maxHeight: Math.round(height-70)
});
}
if(resizeVideoTips)
{
$videoTips.css({
width: Math.round(width - 50),
height: Math.round(height-70)
});
}
}
}