Home

New Content Highlighter

When it comes to webpages like blogs or news sites, most of the time, visitors are only interested in what is new.  Here’s a javascript I wrote that highlights new content via a subtle light-yellow background that fades in.  It is completely client-side, using cookies to store what the visitor has seen.

The script itself is very simple.  It just loops through all the elements on a page, looking for elements with an XHTML id matching a regular expression (in this case, ids starting with "post").  When it finds one, it checks whether a cookie for that id exists and if it doesn’t, it sets the cookie and highlights the element.

Happy highlighting :D

Release Files:

Related Posts

Comments are closed.