Need to find height of hidden div on page (set to display:none)

前端 未结 13 1547
萌比男神i
萌比男神i 2020-11-27 06:00

I need to measure the offsetHeight of a div that is inside of a hidden element.

13条回答
  •  离开以前
    2020-11-27 06:53

    If you use style.display = "none", the element will have 0 width and height,
    but using the style.visibility = "hidden" instead, the element will have the width and height calculated by the browser (as normally).

提交回复
热议问题