将“窗口高度”指定为“文档高度”

Assign Window Height to Document Height

本文关键字:高度 文档 文档高度 窗口高度 窗口      更新时间:2024-01-08

关于如何实现这一点,有什么想法吗?

$(document).css('height', $(window).height())
$('body, html').height($(window).height())
alert('$(document).height(): ' + $(document).height() + "'n$('body').height(): " +   $('body').height() + "'n$('html').height(): " + $('html').height() + ''n$(window).height(): ' + $(window).height())
$("html,body").css("height", screen.height);​

我的小提琴

获取屏幕宽度和高度。

alert ("screen W = " + screen.width );
alert ("screen H = " + screen.height );

试试这个css:

body {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}