2009-07-11, 03:47 AM
I have this following code:
It makes my sidebar disappear when a link is clicked, however, when, I my sidebar disappears, my forum is still the same width as it was with the sidebar there, leaving a lot of white space.
I wish to clear that white space by making the forum increase in width to (100%) when the sidebar is gone, so could I add another factor to the javascript?
So, other than making the display: none; turn into display: block;, can I also add width: 75%; to width: 100%; when clicked?
Something like IPB's over here:
http://forums.invisionpower.com/
One more thing, when the sidebar is there, it shows hide sidebar, when it's not, it still says hide sidebar.
Is there someway to make it say show sidebar afterwards? I have Yumi's PHP in Templates and Conditionals installed.
This is my code:
<script type="text/javascript">
function toggleLayer( whichLayer )
{
var elem, vis;
if( document.getElementById )
elem = document.getElementById( whichLayer );
else if( document.all )
elem = document.all[whichLayer];
else if( document.layers )
elem = document.layers[whichLayer];
vis = elem.style;
// if the style.display value is blank we try to figure it out here
if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
</script>
It makes my sidebar disappear when a link is clicked, however, when, I my sidebar disappears, my forum is still the same width as it was with the sidebar there, leaving a lot of white space.
I wish to clear that white space by making the forum increase in width to (100%) when the sidebar is gone, so could I add another factor to the javascript?
So, other than making the display: none; turn into display: block;, can I also add width: 75%; to width: 100%; when clicked?
Something like IPB's over here:
http://forums.invisionpower.com/
One more thing, when the sidebar is there, it shows hide sidebar, when it's not, it still says hide sidebar.
Is there someway to make it say show sidebar afterwards? I have Yumi's PHP in Templates and Conditionals installed.
This is my code:
<a href="javascript:toggleLayer('f_h');" title="Hide Sidebar">
Hide Sidebar
</a>
I'd really appreciate it if you could help!