原生js获取window高和宽

视口的宽和高

var pw = window.innerWidth,
	ph = window.innerHeight;

	if(typeof pw != "number"){

		
			pw = document.documentElement.clientWidth;
			ph = document.documentElement.clientHeight;
		

	}


	console.log(pw,ph);

 

posted @ 2015-07-26 10:47  唸随爱  阅读(1584)  评论(0编辑  收藏  举报