outerHeight(true) gives wrong value

前端 未结 10 1541
旧时难觅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:24

    the one that worked exactly as it should for me was a combine of both @Matt Reilly & @Lasha answers

    $(window).load(function() {
        setTimeout(function() {
            // all the logic in here
        }, 1);
    });
    

    i used to put the code in in $(document).ready(function(){...}); but it gets wanky sometimes so the above works perfectly.

提交回复
热议问题