js缩放整体页面-----兼容ie和火狐,谷歌应该可以自己试一下

1.前言。
  如题。
2.代码
 
<script type="text/javascript">
	
	var size = 1.0;  
	function zoomout() {  
	 size = size + 0.1;  
	 set(); 
	}  


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


	function set() {  
	 //document.body.style.cssText = document.body.style.cssText + '; -webkit-transform: scale(' + size + ');-webkit-transform-origin: 0 0;';   
	 //document.body.style.cssText = document.body.style.cssText + '; -webkit-transform: scale(' + size + '); '; 
	 //$(body).css("width","120%);
	document.body.style.zoom = size;
	document.body.style.cssText += '; -moz-transform: scale(' + size + ');-moz-transform-origin: 0 0; ';     //
	} 
	//缩小比例减掉一个值,值越大越小
	zoomin(0.5);
	</script>


猜你喜欢

转载自nannan408.iteye.com/blog/2289418
今日推荐