P
P
Pavel Antonov2017-02-24 10:23:36
JavaScript
Pavel Antonov, 2017-02-24 10:23:36

How to make fade wait for animation to finish?

Guys tell me how to make switching tabs more correctly. I sketched out the code, don’t troll much, I’m learning, I understand that there are ready-made tabs and everything else, but I’m interested in slowly understanding it myself.

There are 2 tabs, switching occurs by clicking only on the 2nd tab, after clicking, the tab headings and the content itself change, if you click on the second tab quickly, an unpleasant moment with fades appears, it seems like you need to use stop () here, but something doesn't work for me.

Demo here

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Vikhryan, 2017-02-24
@d_hawk

In jquery, in order for the function to be executed after the animation has played, it must be passed as the second argument (callback). For example, so $( 'a' ).fadeOut( 600, function(){} ). Everything is written in the documentation, even with examples: api.jquery.com/fadeout
.fadeOut( [duration ] [, complete ] ), where complete is a callback upon completion of the animation.

M
Max Medar, 2017-11-03
@MedVedar

https://codex.wordpress.org/Function_Reference/get...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question