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:

1.
<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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.