outerHeight(true) gives wrong value

前端 未结 10 1479
旧时难觅i
旧时难觅i 2021-01-07 18:21

I want the height of a container element, including margins and paddings.

When I hover over the element in Chrome development tool, I get the value that I\'m lookin

10条回答
  •  一向
    一向 (楼主)
    2021-01-07 18:40

    I had the same problem. I get the correct height in Chrome by using setTimeout to wait a bit:

        setTimeout ( function () {
            var ht = $('.my-class').outerHeight( true );
        }, 1);
    

    I hope that helps!

提交回复
热议问题