I'm encountering an issue with a scrollable div that I scale using css3 transform. When zooming in, the content scales up properly, but when zooming out below 100%, the vertical scrolling capability of the container div remains unchanged.
To better illustrate this problem, I've created a jsfiddle example
CSS:
.scrollable
{
height: 250px;
width: 250px;
overflow: auto;
background-color: green;
}
.content
{
height :500px;
width : 500px;
background: linear-gradient(red, blue);
...
}
JS/jquery:
function scaleContent(newScale){
var $content = $("#content");
var scaleString = "scale("+newScale+")";
//var height = (newScale<1)? $("#content").height()/scale*newScale : originalHeight;
$content.css({
'-webkit-transform' : scaleString,
'-webkit-transform-origin' : '0 0',
...
//'height' : height +'px'
});
scale=newScale;
}
The horizontal scrolling works correctly after scaling, but the vertical scrolling does not adjust below 100% scale.
It may appear that the vertical scrolling changes on the first zoom out, but it's just due to the removal of the horizontal scrollbar.
I attempted to manually adjust the height of the content element, but it caused issues with the dimensions of the content itself.
The ellipses indicate areas where code repetitions exist for compatibility with different browsers.