UNPKG

zent

Version:

一套前端设计语言和基于React的实现

18 lines (17 loc) 500 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = getViewportSize; /** * 获取viewport的宽高 */ function getViewportSize() { // http://stackoverflow.com/questions/1248081/get-the-browser-viewport-dimensions-with-javascript var doc = document.documentElement; return { width: Math.max(doc.clientWidth, window.innerWidth || 0), height: Math.max(doc.clientHeight, window.innerHeight || 0) }; } module.exports = exports["default"];