jQuery: Get height of hidden element in jQuery

后端 未结 14 2446
南方客
南方客 2020-11-22 09:49

I need to get height of an element that is within a div that is hidden. Right now I show the div, get the height, and hide the parent div. This seems a bit silly. Is there a

14条回答
  •  再見小時候
    2020-11-22 10:25

    You could also position the hidden div off the screen with a negative margin rather than using display:none, much like a the text indent image replacement technique.

    eg.

    position:absolute;
    left:  -2000px;
    top: 0;
    

    This way the height() is still available.

提交回复
热议问题