Syntax

HTML Example

We will use the following HTML for the examples listed below.

Example

In the following examples, we will look at the difference between using the callback function and omitting the callback function. In the first example, no callback function is used. Notice that the toggle image changes before the animation is completed. In the second example, the callback function is used and the toggle image is not modified until the animation is completed.