DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Page Zoom With Javascript
var size = 1;
var factor = 0.95;
var lo = 0.5;
var hi = 1.7;
function sizechange() {
var body = document.getElementsByTagName('body')[0];
if (size <= lo) {
factor = 1.05;
}
if (size >= hi) {
factor = 0.95;
}
size = size * factor;
body.style.fontSize = '' + size + 'em';
setTimeout('sizechange()', 100);
}
window.onload = sizechange;






Comments
Arvind Bhardwaj replied on Wed, 2012/11/28 - 1:19am
This script zooms only the text content on the page. Other page elements like images, tables, divs are not zoomed.