I did some Javascript hiding of a DIV element a few days ago, but when I hid it, the space it took up when it was visible was still taken up.
The construct is a DIV element with a table enclosed. Everything becomes invisible, but I'd like the elements below the DIV to move up the page...
Any suggestions?
dcrombie
11:57 am on Dec 5, 2003 (gmt 0)
AFAIK, the behaviour in this situation is "undefined" in CSS. The documentation states that different user-agents may behave differently in these cases (they refer to changing the widths of elements but I think it still applies to your case).
Zaphod Beeblebrox
1:06 pm on Dec 6, 2003 (gmt 0)
Bugger. Thanks anyway! ;)
Birdman
1:11 pm on Dec 6, 2003 (gmt 0)
Are you using the visibility or display property to hide the div? I may be wrong, but I think using display: none; will take the element and the space out of the document. Worth a try, I guess.
Zaphod Beeblebrox
10:05 am on Dec 8, 2003 (gmt 0)
I'll try, I was using display.visibility=hidden...
BlobFisk
1:36 pm on Dec 8, 2003 (gmt 0)
As birdman suggested, use display:none;
In a DOM1 environment, you could use a function like:
function showLayer(layerID) { document.getElementById(layerID).style.display='block'; }
function hideLayer(layerID) { document.getElementById(layerID).style.display='none'; }