#javascript-code-14-fadeIn.js / js
function fadeIn( elem ) { // Start the opacity at 0 setOpacity( elem, 0 ); // Show the element (but you can see it, since the opacity is 0) show( elem ); // We�re going to do a 20 �frame� animation that takes // place over one second for ( var i = 0; i <= 100; i += 5 ) { // A closure to make sure that we have the right �i� (function(){ var pos = i; // Set the timeout to occur at the specified time in the future setTimeout(function(){ // Set the new opacity of the element setOpacity( elem, pos ); }, ( pos + 1 ) * 10 ); })(); } }
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.