4

I know that transitions don't work when changing the display mode between classes.

So I was thinking to use jQuery to change classes. I made a fiddle here: http://jsfiddle.net/v8GTz/ but it doesn't seem to work properly :(

It looks like the border is getting animated, but the height doesn't. And opacity only animates once.

What am I doing wrong here?


ok, I managed to make the fade effect work, but the height is still not animating:

http://jsfiddle.net/XYD9K/

1 Answer 1

2

Specifically, you aren't removing the class of "expanded" when you stop hovering on your "ul ul". You're actually adding it again, which I guess is an unintended mistake!

Sign up to request clarification or add additional context in comments.

1 Comment

I've added an updated jsfiddle for you, jsfiddle.net/XYD9K/1, which shows how you can get your desired effect without needing to worry about Javascript. Note that the elements are always display:block,but we alter the max-height and opacity to get our desired effect. This isn't perfect, you may wish to add some javascript in to determine the height of the dropdown, and alter that ul's "max-height" value to match it. This will provide the most crisp slide up/down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.