js实时监听窗口变化总结

<script>浏览器

window.onresize = function () {ide

var Width = window.innerWidth//浏览器窗口的内部宽度(包括滚动条)ip

|| document.documentElement.clientWidthit

|| document.body.clientWidth;io

var Height = window.innerHeight//浏览器窗口的内部高度(包括滚动条)console

|| document.documentElement.clientWidthfunction

|| document.body.clientHeight;class

console.log(Width, Height);cli

}di

</script>

相关文章
相关标签/搜索