JavaScript获得页面区域大小的代码
var Client = {
viewportWidth: function() {
return self.innerWidth || (document.documentElement.clientWidth || document.body.clientWidth);
},
viewportHeight: function() {
return self.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight);
},
viewportSize: function() {
return { width: this.viewportWidth(), height: this.viewportHeight() };
}
};
Client.viewportHeight();