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();

posted @ 2014-03-12 16:57  leejersey  阅读(332)  评论(0编辑  收藏  举报