PDA

View Full Version : Making a DIV fade in?



Remotive
08-25-2007, 07:39 PM
Is it possible, I have looked around, yet nothing. :(

djr33
08-25-2007, 08:03 PM
Yes. http://www.twey.co.uk/?q=fading

You could do something similar yourself, by lowering/increasing the opacity at a set interval in a loop.

boxxertrumps
08-25-2007, 08:39 PM
... Miscillaneous head section junk ...
<script type="text/javascript">
var per=0.01;
function repeat() {
if (per<1) {
document.getElementById("hugteim").style.opacity=per;
per+=0.01;
};
document.getElementById("hugteim").style.opacity=per;
setTimeout("repeat()",100);
}
</script>
</head>
<body onload="repeat()">
<div id="hugteim">THIS SHOULD FADE IN</div>
... rest of body ...

EDIT oops, i should reply quicker...

jscheuer1
08-25-2007, 08:56 PM
Just adding a note here:

Applying any filter to text in IE 7 for any purpose, including fading it in or out will make it look odd. Text can (in many cases) be faded in and out in any browser by gradually changing its color style value in relation to its background color style value.

In situations where images are involved, fade the image, not the text, to avoid this filter bug in IE 7.

There are situations where neither of these workarounds will be applicable. Then you are faced with either excluding IE 7 from the effect or living with the noticeably inferior text rendering quality of the text being filtered.