Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zoom css/javascript

Tags:

I would like to know how zoom property can be controlled through javascript, like div.style.top , how to specify for zoom ?

like image 366
sat Avatar asked Jan 08 '10 08:01

sat


2 Answers

The Firefox & Chrome (Webkit) equivalents to the IE-specific zoom property are, respectively, -moz-transform and -webkit-transform.

A sample code would be:

.zoomed-element {
    zoom: 1.5;
    -moz-transform: scale(1.5);
    -webkit-transform: scale(1.5);
}

You'd have to be a bit more careful with Javascript (test for existence first), but here's how you'd manipulate them:

el.style.zoom = 1.5;
el.style.MozTransform = 'scale(1.5)';
el.style.WebkitTransform = 'scale(1.5)';
like image 59
K Prime Avatar answered Sep 19 '22 22:09

K Prime


It is a property of style, but it's not supported by all browsers. It's a non-standard Microsoft extension of CSS that Internet Explorer implements. It is accessed like this:

div.style.zoom
like image 37
zombat Avatar answered Sep 20 '22 22:09

zombat