I am having a problem where I scale a div to fit it's parent. This problem only seems to show up in Internet Explorer. I've only tested on versions 9 and 11 but I'm sure it exists in others.
Whenever I scale the window down the div's scale as they are supposed to. However, in internet explorer, they leave this weird white space to the right. This seems to be happening inside #pageContent
and the scaling of #formScale
seem's to be the issue.
Does anyone have any ideas on why this may be happening? Because I can not figure it out for the life of me.
note - I do not want to solve this by hiding overflow
JSFiddle | JSFiddle Full Screen
Here is an image showing the white space when IE 9's window is shrunk:
HTML
<div id="pageContent">
<div id="formBox">
<div id="formScale">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
</div>
</div>
CSS
#pageContent {
width:100%;
overflow:auto;
padding-bottom:20px;
border:1px solid red;
}
#formBox { display:block;height:auto; padding:15px 10px;border-bottom:5px solid red;}
#formScale::after {
display: block;
content: '';
padding-bottom:5px;
}
#formScale
{
display:block;
position:relative;
width:940px;
left:50%;
margin-left:-470px;
-webkit-transform-origin: top center;
-moz-transform-origin: top center;
transform-origin: top center;
-ms-transform-origin: top center;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.box { height:1178px;width:940px;background-color:yellow;margin-bottom:10px; }
JS
resize();
zoomProject();
$(window).resize(function (e) {
resize();
zoomProject();
});
function resize() {
$("#pageContent").css('height', ($(window).height()-30) + 'px');
}
function zoomProject()
{
var maxWidth = $("#formBox").width(),
percent = maxWidth/930;
$("#formScale").css({
'transform': 'scale(' + percent + ')',
'-moz-transform': 'scale(' + percent + ')',
'-webkit-transform': 'scale(' + percent + ')',
'-ms-transform': 'scale(' + percent + ')'
});
}