Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show div with jQuery. css question

I have three divs with display: inline-block. In every div i have div with display: none when im trying to show hiding div with $('#div-id').show(1000) nearest divs 'jump around' What should i change? I do like to see div under div just draw and the left or right div doesn't change his place. For example two divs with my problem there (hide div shows up onchange in the textbox)

like image 573
Petya petrov Avatar asked Dec 16 '22 16:12

Petya petrov


2 Answers

http://jsfiddle.net/WZCJu/13/

I added this CSS:

#amount-div, #specific-div {
    width: 300px;
    vertical-align: top
}

Version without the width, you may like it better:

http://jsfiddle.net/WZCJu/15/

like image 154
thirtydot Avatar answered Dec 19 '22 07:12

thirtydot


Try using css's visibility property instead since it retains the element's position in the flow.

Docs: http://www.w3schools.com/css/pr_class_visibility.asp

Example:

<div id="herp" style="width: 100px; height: 40px; visibility: hidden;">plarp</div>
<div id="derp" style="width: 100px; height: 40px; visibility: visible;">slarp</div>
like image 34
John Himmelman Avatar answered Dec 19 '22 06:12

John Himmelman