...

View Full Version : Minimizing and repositioning.... Stacked Divs.



dep
12-14-2005, 05:31 PM
Hello. I have three DIVs that are stacked vertically. Each section (div) I want to be able to 'collapse' or minimize, and when that happens, for instance when the first div is 'minimized' the second two divs shift their left/top positions to fill the space. Right now, I'm doing this automatically, by creating a javascript function and changing the top/left and "height" properties manually.

Is there a better way to do this? there has to be...

dep

liorean
12-14-2005, 06:04 PM
There are ways of getting the browser to do this for you, but what works depends a bit on your code. Are the divs relatively or absolutely positioned? Are they floated or not? Are they direct siblings?

dep
12-14-2005, 06:07 PM
There are ways of getting the browser to do this for you, but what works depends a bit on your code. Are the divs relatively or absolutely positioned? Are they floated or not? Are they direct siblings?

I was thinking that they should be left floated sibling DIVs of one single parent containing the three sibling divs... Positioned relatively. Is that the best way?

dep

liorean
12-14-2005, 07:45 PM
It sounds like a good solution. Now, how exactly are you "minimising" them?

dep
12-14-2005, 09:25 PM
It sounds like a good solution. Now, how exactly are you "minimising" them?

Well, right now, I'm passing the div ID to a function that modifies the 'style.height' of the div, which resizes the DIV, but doesn't do much on repositioning/resizing the other divs.

liorean
12-14-2005, 09:32 PM
Not sure exactly how you want this done, but here's a proof of concept of how to do it using changes to the element's classes, letting the browser automatically position and redraw things.

<uri:http://liorean.net/help/dep/>

dep
12-14-2005, 09:44 PM
Not sure exactly how you want this done, but here's a proof of concept of how to do it using changes to the element's classes, letting the browser automatically position and redraw things.

<uri:http://liorean.net/help/dep/>

i will check it out. Thank you!

dep
12-15-2005, 05:37 PM
Not sure exactly how you want this done, but here's a proof of concept of how to do it using changes to the element's classes, letting the browser automatically position and redraw things.

<uri:http://liorean.net/help/dep/>

This is handy, but in each DIV is a big table to position the elements. I need to modify the script section that calls 'firstChild,' but don't really know how :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum