用高度自动获得绝对元素的高度 [英] get height of absolute element with height auto

查看:139
本文介绍了用高度自动获得绝对元素的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有类似这里的情况 DEMO



<想知道如何获得扩大孩子的身高?因为现在jquery height()给了我0



任何建议或引用。

解决方案

对于我所了解的问题,您正在运行动画并同时获取高度。



如果您添加一个与动画时间相等的超时值,您会得到 90 作为结果。 b
$ b

  $(.list-el).mouseover(function(){
var b = $(。el-bottom );
setTimeout(function(){
alert(b.innerHeight());
},1700)
});


I have situation like here DEMO

Was wondering how to get height of expanded child? Because now jquery height() gives me 0

Any suggestions or references.

解决方案

For what I realize, the problem is that you are running the animation and getting the height at the same time.

If you add a timeout equal to the animation time you get 90 as the result.

$( ".list-el" ).mouseover(function() {
  var b = $(".el-bottom");
    setTimeout(function () {
       alert(b.innerHeight());
    }, 1700)
});

这篇关于用高度自动获得绝对元素的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆