Developer Checklist — JavaScript Appendices

Correct code

JS_C_A8: Use scripting to create a blinking animation that stops in 5 seconds

This example shows how a blinking or flashing animation must include code that continually checks the elapsed time, to make sure it doesn't run for more than 5 seconds.

Live Demo

The demo below is an example of the kind of notification you might see in a web-based email client. It flashes at first to draw attention to itself, but the flashing is programmed to stop after 5 seconds:

You have 3 new messages!

JavaScript Code

The JavaScript code for this example can be found in: JS_C_A8.js

The CSS for this example can be found in: JS_C_A8.css