W
W
Will_Diaborn2021-02-13 16:28:43
css
Will_Diaborn, 2021-02-13 16:28:43

Triggering an animation after removing the hidden property?

When the hidden class is removed, the animation does not play.

$(this).removeClass('hidden');	
$(this).css('transform','translateY(0)');

But if you paste the output into the console before that, it starts.
console.log($( this ).css('transform'));;
$(this).removeClass('hidden');	
$(this).css('transform','translateY(0)');


Why is this, and what is an adequate way to make the animation work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2021-02-13
@Will_Diaborn

And so?

$(this).removeClass('hidden');	
setTimeout(() => $(this).css('transform','translateY(0)'), 0);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question