Fade Text In on Page Load
Published January 22nd, 2004 in design + devI learned a neat little HTML/Javascript trick on the about page of the newly launched Orkut from Google.
Here is the trick (let the page load entirely, then watch the next line (on smaller pages it’s much cooler… see the individual story archive page to see it happen the way it should really happen)):
This text will fade in on page load. But this text won’t (It’s displayed in-line as the page is built).
It’s accomplished with code that looks like this:
<html>
<head>
<script language="javascript">
col=255;
function fade() { document.getElementById("fade").style.color="rgb(" + col + "," + col + "," + col + ")"; col-=5; if(col>0) setTimeout('fade()', 10); }
</script>
</head>
<body onLoad="fade()">
<p>
<span id="fade">This text will fade in.</span> But this text won't.
</p>
</body></html>
Pretty cool huh?
(If it doesn’t seem to work for you, it’s probably because this page loads pretty slowly… see the individual archive page for it to look more natural.)
8 Responses to “Fade Text In on Page Load”
Leave a Reply
Search
Subscribe
Archives
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- August 2005
- July 2005
- June 2005
- May 2005
- April 2005
- March 2005
- February 2005
- January 2005
- December 2004
- November 2004
- October 2004
- September 2004
- August 2004
- July 2004
- June 2004
- May 2004
- April 2004
- March 2004
- February 2004
- January 2004
- December 2003
- November 2003
- October 2003
- September 2003
- August 2003
- July 2003
- June 2003
- May 2003
- April 2003
- March 2003
- February 2003
- January 2003
- December 2002
- November 2002
- October 2002
- September 2002
- August 2002
- May 2002
Categories
- asides (508)
- baby (6)
- design + dev (142)
- for sale (7)
- get a job (12)
- investing (6)
- leadership + management (152)
- life stories (257)
- macintosh (320)
- marketing + advertising (225)
- Moveable Type (52)
- organization (6)
- photography + video (68)
- publishing + content (136)
- random (328)
- Saab (1)
- sales and selling (98)
- small business (147)
- startup (1)
- stuff (70)
- sysadmin (40)
- travel (43)
- Video (4)
- windows (69)
- WordPress (13)

You could use an array and create a neat waterfall effect with this. I changed it already, but can’t post it here.
If you’d like to see it, let me know.
i wanna see, i wanna see
very nice effect indeed.
Might have to see if that can be used to fade in images if you pre-load them. That would be pretty slick.
Hmm, interesting. Thanks for the demo (not all of us were favored with an invitation to Orkut).
Very nice. Is it possible to make it work on a black bagground - fading into white?
Found out is was…
Changing 225 to 0, col- to col+ and col>0 to col<255…
Hello,
very cool script but I just want to know why it doesn’t word on SPAN A HREF nor H tags?
how would you slow the fade down or delay it?