I am finding it hard to get fully cross browser CSS zoom properties ..what I\'ve is only these
zoom: 2;
-moz-transform: scale(2);
If scripting is feasible then you can avoid both the collision of multiple supported zoom properties and the browser sniffing by using future-proof feature detection.
Note: I'm using jQuery here for convenience, but it could be written without it.
.zoom {
-moz-transform-origin: 0 0;
-o-transform-origin: 0 0;
-webkit-transform-origin: 0 0;
}
Foobar
var strPropZoom = "zoom";
var blnPropZoomUseScale = false;
$(function() {
var jqBody = $("body");
// Determine the supported 'zoom' method
switch (true) {
case Boolean(jqBody.css("zoom")) : break;
case Boolean(jqBody.css("-moz-transform")) : strPropNameZoom = "-moz-transform"; blnPropZoomUseScale = true; break;
case Boolean(jqBody.css("-o-transform")) : strPropNameZoom = "-o-transform"; blnPropZoomUseScale = true; break;
case Boolean(jqBody.css("-webkit-transform")) : strPropNameZoom = "-webkit-transform"; blnPropZoomUseScale = true; break;
}
})
Then when zooming is required simply invoke:
var intZoom = 2.5; // NB: This could be calculated depending on window dimensions
$(".mySelectorClass")
.css(
strPropZoom
,(blnPropZoomUseScale ? "scale(" + intZoom + ")" : intZoom)
)
.addClass("zoom");