rstacruz / jquery.transit

Super-smooth CSS3 transformations and transitions for jQuery
http://ricostacruz.com/jquery.transit
7.29k stars 864 forks source link

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

Open NV opened 11 years ago

NV commented 11 years ago

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

NV commented 11 years ago

Rationale: CSS transition from/to auto values.

rstacruz commented 11 years ago

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

rstacruz commented 11 years ago

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

NV commented 11 years ago

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

benguild commented 10 years ago

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' } );
} );
NV commented 10 years ago

Still relevant, I just rebased from the upstream.

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

sdhull commented 10 years ago

:100: :+1:

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() :grin:

sdhull commented 10 years ago

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 commented 10 years ago

@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 commented 8 years ago

Still not merged? wah 😒