CSS3 Transitions with toggleClass

半腔热情 提交于 2019-12-05 01:29:21

This works:

http://jsfiddle.net/Eric/XcFxQ/2/

Although the height is not strictly auto. It manually sets the height in order to make it animate.

I was able to get it to work correctly without -webkit-transition-property and instead using jQuery 1.7 with jQuery UI as in this fiddle:

http://jsfiddle.net/pjFAt/

In my testing, this produced the cleanest, most robust results.

Now, I'm not sure if you're keen on including jQuery UI in your webpage. If not, it's my best guess that you might have to work around the rendering flaws using some more Javascript (ie. if hasClass, then animate, etc...)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!