Skip to content
Justice Tech School

Fading

fadeIn, fadeOut, fadeToggle and fadeTo change opacity over time. The last argument can be a callback that runs when finished.

Example
$('#box').fadeOut(400, function () {
  console.log('done');
});
$('#box').fadeTo(300, 0.5);

Exercise

Fade to half.

fadeTo(300, )

Quiz Test

What does a callback do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.