(function(){
	var w = window.screen.width; //屏幕宽度
	var targetW = 320;
	var scale = w/targetW; //当前尺寸/目标尺寸  缩放比例
	var meta = document.createElement("meta");
	meta.name = "viewport";
	meta.content = "user-scalable=no,initial-scale="+scale+",minimum-scale="+scale+",maximum-scale="+scale+""
	document.head.appendChild(meta); //添加标签
})();

 

自动在页面插入meta 标签 并设置视口

Last modification:July 12th, 2018 at 09:21 am
If you think my article is useful to you, please feel free to appreciate