TheC2Group / accordion

Accessible accordion using CSS transition to expand and contract.
MIT License
2 stars 2 forks source link

Configure accordion so that the item div is not necessary #1

Open c2dev opened 9 years ago

c2dev commented 9 years ago

Is there a way to configure the accordion so that the item div isn't necessary? Primary reason being that in some cases it makes it impossible to make your code both valid and semantic. Like in the case of an FAQ list, which I believe should be marked up like so:

<dl class="accordion">
    <dt class="target">Question 1</dt>
    <dd class="panel">Answer 1</dd>
    <dt class="target">Question 2</dt>
    <dd class="panel">Answer 2</dd>
</dl>
cuth commented 9 years ago

Here is the problem:

Accordion is using the item container to animate the height attribute. This turned out to be the least hacky solution to measure the height of the panel without having to show and hide it really fast.

Solutions to measuring the height of the panel while it is disabled are welcome.

mrself commented 8 years ago

I do not understand why measuring height is important here. Why not use jQuery methods slideDown, slideUp functions which do the same?

cuth commented 8 years ago

Yes, jQuery makes animating height very easy. But the animation is not smooth and this was one of the main reasons to make this module.