javascript - Why is the value obtained using jq's outerHeight() inaccurate?
淡淡烟草味
淡淡烟草味 2017-05-18 10:57:02
0
4
687


##As shown in the picture, shouldn’t I get 55.17?

淡淡烟草味
淡淡烟草味

reply all(4)
滿天的星座

$('.pr-tab').get(0).getBoundingClientRect().height gets the real data
For details, please refer to http://stackoverflow.com/ques...

PHPzhong

Returns the value represented by an integer (excluding "px"), or null if the method is called on an empty collection.

The document says that the outerHeight() method can only return an integer value. Your 55.17 was rounded off and only returned 55

左手右手慢动作

I usually use element.offsetHeight; && element.offsetWidth in native JS. Reference link https://developer.mozilla.org...

PHPzhong

Give a delay. You have started calculating the height before the dom is inserted. Give a delay of 50
ms before getting the value

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template