jQuery 獲取元素的渲染高度? - jQuery get the rendered height of an element?

問題:

How do you get the rendered height of an element?你如何獲得元素的渲染高度?

Let's say you have a <div> element with some content inside.假設您有一個<div>元素,其中包含一些內容。 This content inside is going to stretch the height of the <div> .裏面的這個內容會拉伸<div>的高度。 How do you get the "rendered" height when you haven't explicitly set the height.當您沒有明確設置高度時,如何獲得“渲染”高度。 Obviously, I tried:顯然,我試過:

var h = document.getElementById('someDiv').style.height;

Is there a trick for doing this?這樣做有技巧嗎? I am using jQuery if that helps.如果有幫助,我正在使用 jQuery。


解決方案:

參考一: https://en.stackoom.com/question/2CvT
參考二: https://stackoom.com/question/2CvT
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章