If I have an element set to display:none.
Firebug tells me the element has:
margin-top/bottom: 20px
padding-top/bottom: 20px
height: -22px
If the element is set to display:block height changes to this:
height: 73px
I need to retrieve the -22px via Jquery, but I’m always getting the 73px no matter what display is set to. Is there a way to get the -22px?
Thanks!
Don’t use jQuery. If you have the element (maybe with
getElementById()), just get itsoffsetHeight. That should be0px– there’s no such thing as negative height, I think that’s just Firebug taking the offsetHeight and subtracting margin/border/padding…I’m almost certain that jQuery will assume you want the actual height when visible, so it’ll do something like “make it visible, get the height, make it invisible again”.