html - Vertically adjusting wrapped divs using jquery toggle -
i have set of divs being built dynamically , include several rows of content. restricting output 3 columns per row. using jquery toggle toggle content within div, attempting move each of divs below (in vertical manner) allow room of reading toggled element. have attempted using following markup:
<script type="text/javascript"> $(".trigger").click(function () { var trigger = $(this); $(this).next(".toggle").slidetoggle(); }); </script> <div id="togglecontainer"> <div> <h3 class="trigger">trigger 1</h3> <ul class="toggle"> <li>line one</li> <li>line two</li> <li>line three</li> </ul> </div> <div> <h3 class="trigger">trigger 2</h3> <ul class="toggle"> <li>line one</li> <li>line two</li> <li>line three</li> </ul> </div> <div> <h3 class="trigger">trigger 3</h3> <ul class="toggle"> <li>line one</li> <li>line two</li> <li>line three</li> </ul> </div> <div> <h3 class="trigger">trigger 4</h3> <ul class="toggle"> <li>line one</li> <li>line two</li> <li>line three</li> </ul> </div> <div> <h3 class="trigger">trigger 5</h3> <ul class="toggle"> <li>line one</li> <li>line two</li> <li>line three</li> </ul> </div> <div> <h3 class="trigger">trigger 6</h3> <ul class="toggle"> <li>line one</li> <li>line two</li> <li>line three</li> </ul> </div> <div> <h3 class="trigger">trigger 7</h3> <ul class="toggle"> <li>line one</li> <li>line two</li> <li>line three</li> </ul> </div> <div> <h3 class="trigger">trigger 8</h3> <ul class="toggle"> <li>line one</li> <li>line two</li> <li>line three</li> </ul> </div> <div> <h3 class="trigger">trigger 9</h3> <ul class="toggle"> <li>line one</li> <li>line two</li> <li>line three</li> </ul> </div> </div>
also, demonstrated in this fiddle
this moving each of elements below right allow viewing of toggled content. question is: how can move content down next row without moving rows right? here example of i'm trying accomplish:
a1 a2 a3
b1 b2 b3
c1 c2 c3
and on click of a1, state of b1 , c1 be:
a1 a2 a3
a1toggle b2 b3
b1 c2 c3
c1
if want overlap content on next row, can position:absolute
class toggle , increase z-index
accordingly
Comments
Post a Comment