function getViewSizeWithoutScrollbar() {//不包含滚动条
return {
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight
}
}
function getViewSizeWithScrollbar() {//包含滚动条
if (window.innerWidth) {
return {
width: window.innerWidth,
height: window.innerHeight
}
} else if (document.documentElement.offsetWidth == document.documentElement.clientWidth) {
return {
width: document.documentElement.offsetWidth,
height: document.documentElement.offsetHeight
}
} else {
return {
width: document.documentElement.clientWidth + getScrollWith(),
height: document.documentElement.clientHeight + getScrollWith()
}
}
}