animate from an auto start height to an unknown height?

I can try to throw this in a fiddle if necessary, it's just fairly convoluted code at the moment. Here is my problem: I have a child div that gets resized because of some dynamic image and text content, and a container parent that gives a nice border around the whole thing. The parent has an auto height (or no height?) so it flows with the child height. The problem is that when I change the child height, I am fading the content out and then back in, so the effective height is 12px (some borders going on). The parent resizes to 12, and then when the child content fades back in, the parent goes to the correct position. It just looks choppy, because you see this process unfolding in the span of 100ms or so. Is there any way to animate this process? I guess ideally I'm looking for something like content.startAnimation and endAnimation, in which you don't have to specify values.
you'll have to set the height before the transition. jQuery can't animate from auto. try something like: $el.height($el.height())

以上就是animate from an auto start height to an unknown height?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准