Work with legacy and simple sites using jQuery selectors, events, AJAX, effects, and plugins.
Lessons
Run code after an animation finishes.
Effect Callbacks is easiest to learn by reading the example, changing it, and observing the result.
$('#toggle').on('click', function () {
$('#panel').toggle(300, function () {
// runs after the animation finishes
const state = $(this).is(':visible') ? 'shown' : 'hidden';
$('#status').text('Panel is ' + state);
});
});Practice the Effect Callbacks example in a small scratch file, then explain what changed and why.