Click to See Complete Forum and Search --> : layer leave space after disappear
d17may
04-07-2006, 08:46 AM
Gmail has create filter link when u click on it a layer opens when u click on hide filter link layer disappears i don't know how to do it.When i make layer invisible it leaves blank space .I want that when layer disappear it leaves no blank space .If possible plz give some sample code
Yuo have probably be using: obj.style.visibility='hidden';
Use: obj.style.display (http://www.quirksmode.org/css/display.html)='none';
You need to use the display method insteads of the visibility.
Basically the visibility method just hides the element while the display method removes the element
Example
<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>
<script type="text/javascript">
function toggleVisibility(){
if(document.getElementById("div1").style.visibility=="visible"){
document.getElementById("div1").style.visibility="hidden"
}
else{
document.getElementById("div1").style.visibility="visible"
}
}
function toggleDisplay(){
if(document.getElementById("div2").style.display=="none"){
document.getElementById("div2").style.display="block"
}
else{
document.getElementById("div2").style.display="none"
}
}
</script>
<a href="#null" onclick="toggleVisibility()">Toggle Visibility</a> <a href="#null" onclick="toggleDisplay()">Toggle Display</a>
<BR><BR>
<div style="background-color:#55aa55;width:100px;height:100px">Dummy Div</div>
<div id="div1" style="background-color:#aaaa55;width:100px;height:100px;visibility:visible">Using visiblity</div>
<div id="div2" style="background-color:#aa5555;width:100px;height:100px;display:block">Using display</div>
<div style="background-color:#5555aa;width:100px;height:100px">Dummy Div</div>
</BODY>
</HTML>
d17may
04-07-2006, 09:43 AM
Thanks friends this is what i want