📌  相关文章
📜  js 使窗口适合内容 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:11.830000             🧑  作者: Mango

代码示例1
/* fit the window size to match the content wrapper */
function fitWindow2Content( contentWrapper ) {
  
    // calculate necessary change in window's width
    var width = window.innerWidth - contentWrapper.clientWidth;

    // calculate necessary change in window's height
    var height = window.innerHeight- contentWrapper.clientHeight;
  
      // resize window to fit content
    window.resizeBy( -width , -height );

}