In iOS5 , I would like to scale a div , so its size is proportional to the view port. When this div contains a video element and the zoom level is too high, rendering is very slow .
Scaling is performed as follows:
var scaleFactor = window.innerWidth / $("#videoContainer").width(); $("#videoContainer").css({ '-webkit-transform': 'scale(' + scaleFactor * 0.9 + ')', '-webkit-transform-origin': '0 0' });
To play click here. Then on your iOS device, click the Show button. Please note that rendering is not smooth.
Full jsfiddle demo
A few notes:
- The error is reproduced only on the iOS device (iPad / iPhone), but not on the desktop
- If
initial-scale set to 1.0 , no error occurs - If a video item is deleted, no error occurs
- Error plays on
iOS6 - I tried to speed up hw by adding this css rule set to div and video
{ transform: translate3d(0,0,0); -webkit-transform: translate3d(0,0,0); } { transform: translate3d(0,0,0); -webkit-transform: translate3d(0,0,0); } { transform: translate3d(0,0,0); -webkit-transform: translate3d(0,0,0); } . But it did not help - I tried deleting the image and replacing it with a yellow background, but that didn't help
source share