I have a section of text nested in div tags that should expand and have the text fade in when a link is clicked. The problem is, that the initial click doesn’t fire the animation, it just fades in the text which is the callback function.
Can’t figure this one out. Others that have experienced this issue talk about padding and CSS, but that’s not the case here.
The problem is that the content of your div is
display: noneon the first click. This means that your div essentially has no content, meaning it has no height. So you are animating from 0 height to 0 height. After the first run of the animation, the content is faded in. Now that there is content, animating the height actually does something.On possibility would be to give it a static height:
http://jsfiddle.net/XPs2w/2/