Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    dep
    dep is offline
    Regular Coder
    Join Date
    Nov 2005
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Minimizing and repositioning.... Stacked Divs.

    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

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeň, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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?
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    dep
    dep is offline
    Regular Coder
    Join Date
    Nov 2005
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by liorean
    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

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeň, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    It sounds like a good solution. Now, how exactly are you "minimising" them?
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #5
    dep
    dep is offline
    Regular Coder
    Join Date
    Nov 2005
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by liorean
    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.

  • #6
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeň, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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/>
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #7
    dep
    dep is offline
    Regular Coder
    Join Date
    Nov 2005
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by liorean
    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!

  • #8
    dep
    dep is offline
    Regular Coder
    Join Date
    Nov 2005
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by liorean
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •