Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition to/from width:auto and height:auto properly #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NV
Copy link

@NV NV commented Jun 24, 2013

Only tested in Chrome 29, Safari 6.0.5 and Firefox 21.0 so far.

@NV
Copy link
Author

NV commented Aug 27, 2013

Rationale: CSS transition from/to auto values.

@rstacruz
Copy link
Owner

Whoa, interesting. This means Transit can also replace .slideUp() / .slideDown(), yes? 👍

@rstacruz
Copy link
Owner

If anyone can help review this, please post your feedback here.

@NV
Copy link
Author

NV commented Aug 28, 2013

It should be feasible to implementing .slideUp() / .slideDown() using this technique. Although. I haven’t actually tried.

@benguild
Copy link

I noticed this as well. If you animate to an "auto" width/height it goes to 0 and then finally sets to that value.

Workaround is to (for example) ... on a DIV:

$('#somediv').transition( { 'height': $('#somediv')[0].scrollHeight+'px' }, 300, function () {
  $('#somediv').css( { 'height': 'auto' } );
} );

Only tested in Chrome 29, Safari 6.0.5 and Firefox 21.0 so far.
@NV
Copy link
Author

NV commented Dec 20, 2013

Still relevant, I just rebased from the upstream.

@benguild this pull-request does it without the workaround.

@sdhull
Copy link

sdhull commented Mar 8, 2014

💯 👍

I have no idea why this works but I can verify that it does indeed work. Check out the jsFiddle

Please merge this! Can't wait to replace slideUp() and slideDown() 😁

@sdhull
Copy link

sdhull commented Mar 8, 2014

PS I briefly tried to redefine slideUp and slideDown, however was stymied when it came to properly dealing with padding and margin. Any tips my friends?

@sdhull
Copy link

sdhull commented Mar 25, 2014

@NV I think your branch breaks the fx queue for opacity animations (somehow, not sure how).

Here's a js fiddle, try out the opacity transition. I've found (bizarrely) that double-clicking it seems to make it transitions work (kinda).

Here's the same fiddle but with current master. Notice the difference in the opacity transition.

Since I have no idea how your patch works, I'm at a loss as to how I might fix it.

@mu3
Copy link

mu3 commented Feb 21, 2016

Still not merged? wah 😒

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants