Concerrning this, I wanted to get the same effect, then I thought I'll just change width of my div on click.
I have a left sidebardiv and contentdiv on the right, and I have an image with onclick trigger, which hides the left sidebardiv and sets the right contentdiv width to 100 %.
It does hide the left sidebardiv but it doesn't expand the contentdiv to 100%, strange thing happens when I press firebug to open, just after its opened the contentdiv then expands to 100%, can anyone figure out what am I doing wrong?
Thank you
Here is some HTML :
<div id="content_holder">
<div class="leftsidebar" id="sidebar">
....
</div>
<div class="content" id="content">
....
</div>
</div>
Here is javascript :
var flag = false;
Page.toogle = function(id)
{
var x = document.getElementById('content');
if(!flag){
document.getElementById(id).style.display = 'none';
x.style.width = '99%';
flag=1;
}
else {
x.style.width = '683px';
document.getElementById(id).style.display = '';
flag=0;
}
}
leftsidebar is passed as an argument to the above function
HERE IS SOME CSS :
div.content {
display: block;
float: left;
width: 683px;
text-align: left;
margin-left:10px;
}
div.leftsidebar {
padding-bottom:20px;
width:303px;
background: url('left_holder.png') left bottom no-repeat;
}
Latest update :
The div streches as it should when I click on window restore button and back. Also when I open firebug I mention that earlier. Is there some kind of hack from javascript that could simulate this event?
More info
I found some similar posts like :
http://stackoverflow.com/questions/667426/javascript-resize-event-firing-multiple-times-while-dragging-the-resize-handle -> I need this resize event to fire when I trigger my Page.toogle function so the div streches properly