Sow nothing reap nothing

JS控制浏览器缩放比例大小

已有12,427次关注

JS代码:

var size = 1.0; 
 
function zoomout(){  
  size = size + 0.1;  
  set(); 
}  

function zoomin(){  
  size = size - 0.1;  
  set();  
}  

function set(){  
  document.body.style.zoom = size;
  document.body.style.cssText += '; -moz-transform: scale(' + size + ');-moz-transform-origin: 0 0; '; 
}

JS调用代码:

放大比例调用:zoomout();
缩小比例调用:zoomin();

已自动关闭评论