javascript - How do I move others divs around upon clicking my jQuery event? -


i have inserted jquery event webpage allows div in page expand reveal more content. i'm having problem surrounding divs not moving down accommodate space needed display expanded div.

i tested div in separate document , found work without fuss. worked other divs sure they'd move upon clicking event. upon inserting same code developed web page however, surrounding divs remain fixed , expansion works behind divs. why might be? 1 of divs beneath expanded 1 somehow fixed?

i researched css property 'position' can't make link between these contributing problem.

incase problem relates of expanded div (instead of surrounding divs), shall post code html, css & javascript/jquery directly relates particular part of webpage. please request further code if feel it's necessary.

thank taking time read.

here code:

html

<div id="showmorelocations-container"><p>more locations</p>     <div class="toggler-expand">      </div> </div> 

css

#showmorelocations-container {     height: 100px;     line-height: 150px;     width: auto;     margin: auto;     margin-bottom: 50px; }  #showmorelocations-container p {     text-align: center;     font-family: 'hind', sans-serif;     font-size: 20px;     font-weight: bold;     text-decoration: none;     position: relative;     top: 50%;     transform: translatey(-50%);     line-height: 100px; }  .toggler-expand {     height: 400px;     width: auto;     background-color: #ffbbbb;     display: none;     margin-top: -25px; } 

jquery

$(function() {     $('#showmorelocations-container').click(function() {         $(this).find('.toggler-expand').slidetoggle();     }); }); 

the issue related fact have set fixed height parent container , try expand child.

change following line:

#showmorelocations-container {    height: 100px;  // change px %    ... } 

to

#showmorelocations-container {    height: 100%;    ... } 

in order allow parent expand if child expands too.

check fiddle here: https://jsfiddle.net/n1dwz8v1/


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -