I have a table. The row is given specific height and overflow is set to hidden. On click, the row will expand down showing hidden contents. I have done this using toggle method. The styling is altered to show contents. This works perfect. But I want to add some sliding animation effect to this. The expansion of row happens immediately after I click it. Instead, I want this to happen in a smooth animated format, like in some jQuery menus. Also I want to hide one open row if another row expands.
You can see a working fiddle Here
Just a way how to do that:
– Set the height of 40px via jQuery, but before doing that, calculate the height of the
‘opened’ element.
-Than just animate on click.
DEMO
P.S.
Remove
height: 40px;for the el.class4from your CSSIf you have to use more than one class here is a demo using tha jQuery
.data():DEMO with .data()