Scribd's zooming functionality is very impressive. All the page content including images and text are zoomed proportionally when you click on their + and - buttons.
For example, try it on http://www.scribd.com/html5.
How do they do this? It doesn't seem to be as simple as controlling the browser zoom (although controlling browser zoom itself is not simple if not possible at all!)
A related question would be how they implement their 'full screen mode'. This question was asked before but that was two years ago when they were still using Flash.
I'd suggest that it might be a simple transformation of a canvas element, but looking at their source this does not appear to be the case.
Instead, it looks like the "Zoom In" function only affects the
img
tags on the page, so I'd say that probably they are just dynamically modifying thewidth
andheight
attributes for those tags. It's not a very sophisticated approach, and certainly doesn't rely on anything introduced in HTML5.Edit:
Chrome's developer tools are excellent. If you observe the DOM between zooms, it's easy to pinpoint how the effect is being implemented. Here's what the markup looks like in the page's default state:
...and after zooming out once:
...and after zooming out again:
So it appears that they have implemented their zoom effect by doing two things:
width
andheight
of the container div.