Highlighting New Elements

The “yellow fade” has become almost a cliché of Ajax: when something new materializes on the page, viewers expect to see it appear with a yellow background, which then slowly fades to white (or whatever the site’s usual background color is). It’s a handy way to let visitors know that something has changed without the overhead of having to keep track of what’s new versus newer versus newest.

It’s also a good introduction to jQuery, as you’ll be able to see how much can be done with only a few lines of code.

To highlight an element’s display:

<script type="text/javascript" src="jquery/jquery.js"></script> <script type="text/javascript" src="jquery/effects.core.js"></script> <script type="text/javascript" src="jquery/effects.highlight.js"></script> ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.