Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 是否检测相对于窗口的div high?_Jquery - Fatal编程技术网

Jquery 是否检测相对于窗口的div high?

Jquery 是否检测相对于窗口的div high?,jquery,Jquery,这是我的jQuery代码,我想给出divtopImgs相对于窗口高度的高度,它是如何工作的 $("#topImgs").css("height", function(){ $( window ).height(); }); 看起来您需要返回窗口的高度: 不过,实际上您可能不需要jQuery。在中,您可以使用: 你是说更像$topImgs.csheigh、$window.height的东西?太好了,非常感谢: $("#topImgs").css("height", functio

这是我的jQuery代码,我想给出divtopImgs相对于窗口高度的高度,它是如何工作的

$("#topImgs").css("height", function(){
        $( window ).height();
});

看起来您需要返回窗口的高度:

不过,实际上您可能不需要jQuery。在中,您可以使用:


你是说更像$topImgs.csheigh、$window.height的东西?太好了,非常感谢:
$("#topImgs").css("height", function () {
    return $(window).height();    /* Some calculation here.. */
});
$("#topImgs").css("height", $(window).height());
#topImgs {
    height: 100vh;
}