javascript - add height to parent element of absolute positioned child on its expand -


i have situation: demo

what try achieve push down row of blocks underneath expanded one. @ first tried use jquery , add height of expanded child parent , way push down lower row of blocks achieve this: http://imgur.com/7k0rc21, on hover height() returns 0 , using delays make animation buggy.

here's code:

html:

<div>     <ul class="list">         <li class="list-el">             <div class="el-top">expand 1</div>             <div class="el-bottom">cupcake liquorice cupcake sweet roll ice cream caramels.                  lollipop dragée chupa chups. sugar plum candy jelly-o bonbon gummies caramels.                 jelly icing tiramisu candy chupa chups chocolate bar.                  sweet pastry jelly-o marshmallow jelly lollipop pie marshmallow cookie.                  lollipop sugar plum lollipop jelly lollipop pudding.                  tart jelly-o gummi bears sweet roll gummi bears.                 jelly icing tiramisu candy chupa chups chocolate bar.                  sweet pastry jelly-o marshmallow jelly lollipop pie marshmallow cookie.                  lollipop sugar plum lollipop jelly lollipop pudding.                  tart jelly-o gummi bears sweet roll gummi bears.             </div>         </li>         <li class="list-el">             <div class="el-top">expand 2</div>             <div class="el-bottom">lollipop sugar plum lollipop jelly lollipop pudding.                  tart jelly-o gummi bears sweet roll gummi bears.                 jelly icing tiramisu candy chupa chups chocolate bar.                  sweet pastry jelly-o marshmallow jelly lollipop pie marshmallow cookie.                  lollipop sugar plum lollipop jelly lollipop pudding.                  tart jelly-o gummi bears sweet roll gummi bears.                 jelly icing tiramisu candy chupa chups chocolate bar.                  sweet pastry jelly-o marshmallow jelly lollipop pie marshmallow cookie.                  lollipop sugar plum lollipop jelly lollipop pudding.              </div>         </li>         <li class="list-el">             <div class="el-top">expand 3</div>             <div class="el-bottom">cupcake liquorice cupcake sweet roll ice cream caramels.                  lollipop dragée chupa chups. sugar plum candy jelly-o bonbon gummies caramels.                 jelly icing tiramisu candy chupa chups chocolate bar.                  sweet pastry jelly-o marshmallow jelly lollipop pie marshmallow cookie.                  lollipop sugar plum lollipop jelly lollipop pudding.                  tart jelly-o gummi bears sweet roll gummi bears.                 jelly icing tiramisu candy chupa chups chocolate bar.                  sweet pastry jelly-o marshmallow jelly lollipop pie marshmallow cookie.                  lollipop sugar plum lollipop jelly lollipop pudding.                  tart jelly-o gummi bears sweet roll gummi bears.             </div>         </li>         <li class="list-el">             <div class="el-top">expand 4</div>             <div class="el-bottom">lollipop sugar plum lollipop jelly lollipop pudding.                  tart jelly-o gummi bears sweet roll gummi bears.                 jelly icing tiramisu candy chupa chups chocolate bar.                  sweet pastry jelly-o marshmallow jelly lollipop pie marshmallow cookie.                  lollipop sugar plum lollipop jelly lollipop pudding.                  tart jelly-o gummi bears sweet roll gummi bears.                 jelly icing tiramisu candy chupa chups chocolate bar.                  sweet pastry jelly-o marshmallow jelly lollipop pie marshmallow cookie.                  lollipop sugar plum lollipop jelly lollipop pudding.              </div>         </li>     </ul> </div> 

css:

ul{     list-style: none;     max-width: 600px;     margin: 0 auto; } .list{     width: 100%;     padding: 0; } .list-el{     width: 100%;     height: 75px;     background: #ff00ff;     margin-top: 10px; }  .el-top{     width: 100%;     text-align: center;     line-height: 75px; }  .el-bottom{     text-align: center;     -webkit-transition: max-height 1.5s ease;     -moz-transition: max-height 1.5s ease;     transition: max-height 1.5s ease;     position: absolute;     background: #f0fff0;     top: auto;     left: 0;     width: 100%;     text-align: left;     height: auto;     max-height: 0;     overflow: hidden; }  .list-el:hover .el-bottom{     display: block;     max-height: 700px; } 

maybe has ideas how solve this? appreciate much.

comment: solutions suggested on link addressing same issue, missed mark on trying achieve therefore question not covering actual question , none of answers suited situation updated question have more clear view. there question asks solutions how height, misses fact how , why use it, therefore solutions of questions doesn't fit one.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -