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

fadeOut() for an element with 'display:none' doesn't fire complete callback #128

Open
Koloto opened this issue Jun 21, 2013 · 6 comments
Open

Comments

@Koloto
Copy link

Koloto commented Jun 21, 2013

Try the example here: http://jsfiddle.net/pD2Ag/3/
The behavior is the same for detached element.
You can remove the link to your plugin from external resources - callbacks will be fired for all elements.

@tD3rk
Copy link

tD3rk commented Aug 5, 2013

I can also confirm this issue.

@Koloto
Copy link
Author

Koloto commented Jan 29, 2014

Hello, Ben. Are there any chances to fix this bug? It's enough to check is(":hidden"). And if this is true, a complete callback should be called immediately.

@zunou
Copy link

zunou commented Jan 29, 2014

+1 for this bug.
same for fadeIn()

@Blackskyliner
Copy link

+1 from me too, see referenced issue.

@michaelBenin
Copy link

Yep, seeing this bug in this code:

this.$el
  .empty()
  .hide()
  .append(template(config))
  .fadeIn('fast');

@Blackskyliner
Copy link

Problem for fadeIn is that it's not trivial to fix with a simple conditional. I tried it for like 1 or 2 days to fix it. But you will always find an edge-case where it won't work. Also the conditional will either blow your mind and have a very high complexity or it will be somehow dumb and not do CSS animations at all... At least the ways I tried it.

fadeOut() is easy as there is some real definition of "not visible". But the visible thing is that like 0.000001 opacity is already something visible. Or in the definition of jQuery: "If it takes space in the layout, its visible"

So simply checking if the object is visible will not solve the fadeIn issue. Also the precision of floats is the next big thing... I tried checking for same opacity and so on and so forth but I then had debug valus like "0.6 === 0.059999999957631" which then broke the whole thing all together again...

Like I said it only applies if you try to fix it in the naive way of adding one or two if's before doing the css animation thing... For those edge-cases where you get the error with fadeIn you may want to add the 'avoidCSSTransitions' as a temporary fix.

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

No branches or pull requests

5 participants