Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Dynamic DIV

Dynamic DIV

Scheduled Pinned Locked Moved Web Development
toolshelpquestion
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CoolASL
    wrote on last edited by
    #1

    Hi all, I have this script where i generate DIVs dynamically and put them one under another by setting their style.top property. Now when i add any thing to the top most positioned DIV and increase its height, it expands and overlaps the DIV below. Is there anyway, in which i can make these DIVs like normally generated DIVs, so that they push down other DIVs when their height is increased. Or is there a workaround for this problem. Thanks in advance. *** Who said nothing is impossible? I have been doing it for a long time ***

    A G 2 Replies Last reply
    0
    • C CoolASL

      Hi all, I have this script where i generate DIVs dynamically and put them one under another by setting their style.top property. Now when i add any thing to the top most positioned DIV and increase its height, it expands and overlaps the DIV below. Is there anyway, in which i can make these DIVs like normally generated DIVs, so that they push down other DIVs when their height is increased. Or is there a workaround for this problem. Thanks in advance. *** Who said nothing is impossible? I have been doing it for a long time ***

      A Offline
      A Offline
      alexey N
      wrote on last edited by
      #2

      Try using "z-index" CSS property. Best regards, Alexey.

      C 1 Reply Last reply
      0
      • A alexey N

        Try using "z-index" CSS property. Best regards, Alexey.

        C Offline
        C Offline
        CoolASL
        wrote on last edited by
        #3

        Can you please explain a bit more as to what z-index property exactly does and how its presence impacts surrounding elements ?? Thanks in advance. *** Who said nothing is impossible? I have been doing it for a long time ***

        A G 2 Replies Last reply
        0
        • C CoolASL

          Can you please explain a bit more as to what z-index property exactly does and how its presence impacts surrounding elements ?? Thanks in advance. *** Who said nothing is impossible? I have been doing it for a long time ***

          A Offline
          A Offline
          alexey N
          wrote on last edited by
          #4

          Look this help with sample: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/zindex.asp Best regards, Alexey.

          1 Reply Last reply
          0
          • C CoolASL

            Can you please explain a bit more as to what z-index property exactly does and how its presence impacts surrounding elements ?? Thanks in advance. *** Who said nothing is impossible? I have been doing it for a long time ***

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            CoolASL wrote:

            and how its presence impacts surrounding elements

            It does not. --- b { font-weight: normal; }

            1 Reply Last reply
            0
            • C CoolASL

              Hi all, I have this script where i generate DIVs dynamically and put them one under another by setting their style.top property. Now when i add any thing to the top most positioned DIV and increase its height, it expands and overlaps the DIV below. Is there anyway, in which i can make these DIVs like normally generated DIVs, so that they push down other DIVs when their height is increased. Or is there a workaround for this problem. Thanks in advance. *** Who said nothing is impossible? I have been doing it for a long time ***

              G Offline
              G Offline
              Guffa
              wrote on last edited by
              #6

              If you position them absolutely there is no way that they can adjust to the size of other elements. Just put them in the normal flow of the page. --- b { font-weight: normal; }

              C 1 Reply Last reply
              0
              • G Guffa

                If you position them absolutely there is no way that they can adjust to the size of other elements. Just put them in the normal flow of the page. --- b { font-weight: normal; }

                C Offline
                C Offline
                CoolASL
                wrote on last edited by
                #7

                Hi Guffa, Thanks for coming to my rescue again. It would really be nice if i could put the DIVs in the normal flow of the page. But since i am required to generate them dynamically, it is not possible to do so. Ok, to tell you the actual thing, i am actually writing a script to display a Dynamic Tree View. I know there are quite a number of such free sources, but i wish to do it on my own so that i can have the display my way. According to my code, when a user clicks on a + sign, 1) The sub-directories are retrieved from the database using AJAX. 2) DIVs are created dynamically and initialized properly 3) The DIVs are embedded inside the parent DIV using appendChild and the height of the parent is increased to accomodate the newly created DIVs. I have to use

                overflow:hidden 
                

                property for all the DIVs because without that the generated DIVs fail to display themselves inside the parent DIV and they get displayed outside the parent DIV on the main page. Now, since the parent DIV has been created in the normal flow, when they expand, they push down the other DIVs under them. But the ones generated by me, fail to do so and overwrite on the ones below. I hope i was able to explain you my logic. Is my logic ok, or is there a better way of doing this thing. I have not tried, but i feel that i should alter the innerHTML of the parent DIV to add the newly created DIVs. Please help me out. Thanks in advance. *** Who said nothing is impossible? I have been doing it for a long time ***

                G S 2 Replies Last reply
                0
                • C CoolASL

                  Hi Guffa, Thanks for coming to my rescue again. It would really be nice if i could put the DIVs in the normal flow of the page. But since i am required to generate them dynamically, it is not possible to do so. Ok, to tell you the actual thing, i am actually writing a script to display a Dynamic Tree View. I know there are quite a number of such free sources, but i wish to do it on my own so that i can have the display my way. According to my code, when a user clicks on a + sign, 1) The sub-directories are retrieved from the database using AJAX. 2) DIVs are created dynamically and initialized properly 3) The DIVs are embedded inside the parent DIV using appendChild and the height of the parent is increased to accomodate the newly created DIVs. I have to use

                  overflow:hidden 
                  

                  property for all the DIVs because without that the generated DIVs fail to display themselves inside the parent DIV and they get displayed outside the parent DIV on the main page. Now, since the parent DIV has been created in the normal flow, when they expand, they push down the other DIVs under them. But the ones generated by me, fail to do so and overwrite on the ones below. I hope i was able to explain you my logic. Is my logic ok, or is there a better way of doing this thing. I have not tried, but i feel that i should alter the innerHTML of the parent DIV to add the newly created DIVs. Please help me out. Thanks in advance. *** Who said nothing is impossible? I have been doing it for a long time ***

                  G Offline
                  G Offline
                  Guffa
                  wrote on last edited by
                  #8

                  CoolASL wrote:

                  It would really be nice if i could put the DIVs in the normal flow of the page. But since i am required to generate them dynamically, it is not possible to do so.

                  Yes, it is. You can dynamically add elements into the page, and it will reflow to accomodate the new elements.

                  I have to use overflow:hidden property for all the DIVs because without that the generated DIVs fail to display themselves inside the parent DIV and they get displayed outside the parent DIV on the main page.

                  That sounds like a strange workaround. Is that because you are positioning the elements absolutely instead of actually placing them inside the parent element? --- b { font-weight: normal; }

                  C 1 Reply Last reply
                  0
                  • C CoolASL

                    Hi Guffa, Thanks for coming to my rescue again. It would really be nice if i could put the DIVs in the normal flow of the page. But since i am required to generate them dynamically, it is not possible to do so. Ok, to tell you the actual thing, i am actually writing a script to display a Dynamic Tree View. I know there are quite a number of such free sources, but i wish to do it on my own so that i can have the display my way. According to my code, when a user clicks on a + sign, 1) The sub-directories are retrieved from the database using AJAX. 2) DIVs are created dynamically and initialized properly 3) The DIVs are embedded inside the parent DIV using appendChild and the height of the parent is increased to accomodate the newly created DIVs. I have to use

                    overflow:hidden 
                    

                    property for all the DIVs because without that the generated DIVs fail to display themselves inside the parent DIV and they get displayed outside the parent DIV on the main page. Now, since the parent DIV has been created in the normal flow, when they expand, they push down the other DIVs under them. But the ones generated by me, fail to do so and overwrite on the ones below. I hope i was able to explain you my logic. Is my logic ok, or is there a better way of doing this thing. I have not tried, but i feel that i should alter the innerHTML of the parent DIV to add the newly created DIVs. Please help me out. Thanks in advance. *** Who said nothing is impossible? I have been doing it for a long time ***

                    S Offline
                    S Offline
                    Shog9 0
                    wrote on last edited by
                    #9

                    CoolASL wrote:

                    I have to use overflow:hidden property for all the DIVs because without that the generated DIVs fail to display themselves inside the parent DIV and they get displayed outside the parent DIV on the main page.

                    You're making this waaay too complex. I'm gonna make one major assumption, that you are not making the parent DIV absolutely positioned or fixing the height - if you are doing either of these, then stop it. With that out of the way, you should be able to add children and the parent DIV will automatically resize to contain them. No manual sizing or positioning required. :)

                    Now taking suggestions for the next release of CPhog...

                    Last modified: Tuesday, April 18, 2006 10:02:10 PM -- spelling...

                    C 1 Reply Last reply
                    0
                    • S Shog9 0

                      CoolASL wrote:

                      I have to use overflow:hidden property for all the DIVs because without that the generated DIVs fail to display themselves inside the parent DIV and they get displayed outside the parent DIV on the main page.

                      You're making this waaay too complex. I'm gonna make one major assumption, that you are not making the parent DIV absolutely positioned or fixing the height - if you are doing either of these, then stop it. With that out of the way, you should be able to add children and the parent DIV will automatically resize to contain them. No manual sizing or positioning required. :)

                      Now taking suggestions for the next release of CPhog...

                      Last modified: Tuesday, April 18, 2006 10:02:10 PM -- spelling...

                      C Offline
                      C Offline
                      CoolASL
                      wrote on last edited by
                      #10

                      Hey thanks Shog. That really helped me out. After reading yours and Guffa's reply I set out again from scratch and found that i made a wrong assumption at one place. Which means that the initial research was defective... :laugh: Thanks for the help. I think i'll be able to continue from here. Thanks a lot. *** Who said nothing is impossible? I have been doing it for a long time ***

                      1 Reply Last reply
                      0
                      • G Guffa

                        CoolASL wrote:

                        It would really be nice if i could put the DIVs in the normal flow of the page. But since i am required to generate them dynamically, it is not possible to do so.

                        Yes, it is. You can dynamically add elements into the page, and it will reflow to accomodate the new elements.

                        I have to use overflow:hidden property for all the DIVs because without that the generated DIVs fail to display themselves inside the parent DIV and they get displayed outside the parent DIV on the main page.

                        That sounds like a strange workaround. Is that because you are positioning the elements absolutely instead of actually placing them inside the parent element? --- b { font-weight: normal; }

                        C Offline
                        C Offline
                        CoolASL
                        wrote on last edited by
                        #11

                        Hey thanks Guffa. That really helped me out. After reading yours and Shog's reply I set out again from scratch and found that i made a wrong assumption at one place. Which means that the initial research was defective... :laugh: Thanks for the help. I think i'll be able to continue from here. Thanks a lot. *** Who said nothing is impossible? I have been doing it for a long time ***

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups