gpt4 book ai didi

javascript - 如何使用浏览器窗口的大小?

转载 作者:太空宇宙 更新时间:2023-11-03 23:24:09 24 4
gpt4 key购买 nike

var wh = $(document.documentElement.clientHeight).height();
var tH = $('.a_Top').height();
var bH = $('.a_BottomBar_b').height();
$('.a_ContentOuter').css('min-height',(wh)+'px');
$('.a_ContentInner').css('min-height',(wh-(tH+bH+29))+'px');

我正在一个函数中编写这段代码,但是当我在 Firefox 中打开这个页面时,它会出错,当我们对整个代码进行评论时它会很好,所以请给我建议并帮助找出使用此代码的正确方法....

最佳答案

添加 $(window).height();

var wh = $(window).height();
var tH = $('.a_Top').height();
var bH = $('.a_BottomBar_b').height();
$('.a_ContentOuter').css('min-height',(wh)+'px');
$('.a_ContentInner').css('min-height',(wh-(tH+bH+29))+'px');
alert($('.a_ContentOuter').css('min-height'));

关于javascript - 如何使用浏览器窗口的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27700348/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com