0

I have a list of tasks in HTML..

When a task is done, jquery fadesOut the li, moves it to the bottom of the list, adds the "checked" class, and then fades in.. all good, except when it fades in, it not only removes the display:none property it added with FadeOut but adds an inline style display:list-item (or any other display property the element had when it was hiding)

I need the li to be exactly the same as it was before, so after the fadeIn, I do:

            li.fadeIn(function(){
                //remove display property
                li.css('display', '');
            });

It is working fine, except when the user checks a task too quickly after one task has been checked, then this code does not run, and the element keeps the display property added by Jquery, which is breaking the list because of some other styles I have applied.

My question is either why the fadeIn doesn't run when another (fadeOut/FadeIn) starts too fast, or how could I stop the fadeIn from adding the attribute.

sigmaxf
  • 7,998
  • 15
  • 65
  • 125

1 Answers1

0

Similiar to How to fade to display: inline-block

Use jQuery animate to handle hiding and showing of your elements via opacity instead of fadeIn so that your display property is unaffected.

Community
  • 1
  • 1
Brad Decker
  • 746
  • 8
  • 20