If you go to google.com, you notice the menu on top slowly appears once you have mouse over the page. I was wondering what does Google use to control the fading effect?
This is actually a rather complex thing to do because of the cross browser differences. The basics are something like the following:
setInterval
to fire a function that increases the opacity by your rate where: setInterval(function(){myElement.style.opacity = parseFloat(myElement.style.opacity)+0.01;}, 1);
Somewhere in ther though you need to check if youve reached the endpoint of your animation and shutdown your interval.