JQuery animate behaviour with inline-block elements

Posted by IlludiumPu36 on Stack Overflow See other posts from Stack Overflow or by IlludiumPu36
Published on 2014-08-19T03:56:03Z Indexed on 2014/08/19 4:20 UTC
Read the original article Hit count: 118

Filed under:
|
|

I'm using JQuery to animate two divs, one on top of the other, inside a another div. The effect is like a button with the top and bottom halves opening up and down to reveal some contents. The idea is to have a number of these 'buttons' in line using float:left

When a button is clicked, the script checks if another button is open, if so, closes that button and opens the clicked button.

This works fine, except I want to change float:left to display:inline-block on the container div class (to prevent wrapping of a number of buttons if the browser is resized). The problem is the layout of buttons breaks as JQuery animate seems to be changing the vertical position of the button containers while animating.

See fiddle

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css