Click to See Complete Forum and Search --> : Can you do this?


Schitty
12-07-2005, 01:12 PM
can you make your text fade from the center of your webpage after you click a link???

drhowarddrfine
12-07-2005, 05:38 PM
Yes, using javascript. You can google for it.

TheBearMay
12-08-2005, 09:49 AM
If we were talking about images there's a shorter way, but IE doesn't like to fade text directly. This should work no matter what the div contains.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript">
/*<![CDATA [*/
fadeVal=100;
function fadeDiv(divName){
document.getElementById(divName).className="opaque"+fadeVal;
fadeVal-=5;
if(fadeVal > 0) setTimeout("fadeDiv('"+divName+"')",50);
}
/*]]>*/
</script>
<style type="text/css">
<!-- /*[CDATA [*/
div.opaque0 {
width: 100%;
opacity:.00;
filter: alpha(opacity=00);
-moz-opacity: 0.00;
}
div.opaque5 {
width: 100%;
opacity:.05;
filter: alpha(opacity=05);
-moz-opacity: 0.05;
}
div.opaque10 {
width: 100%;
opacity:.10;
filter: alpha(opacity=10);
-moz-opacity: 0.10;
}
div.opaque15 {
width: 100%;
opacity:.15;
filter: alpha(opacity=15);
-moz-opacity: 0.15;
}
div.opaque20 {
width: 100%;
opacity:.20;
filter: alpha(opacity=20);
-moz-opacity: 0.20;
}
div.opaque25 {
width: 100%;
opacity:.25;
filter: alpha(opacity=25);
-moz-opacity: 0.25;
}
div.opaque30 {
width: 100%;
opacity:.30;
filter: alpha(opacity=30);
-moz-opacity: 0.30;
}
div.opaque35 {
width: 100%;
opacity:.35;
filter: alpha(opacity=35);
-moz-opacity: 0.35;
}
div.opaque40 {
width: 100%;
opacity:.40;
filter: alpha(opacity=40);
-moz-opacity: 0.40;
}
div.opaque45 {
width: 100%;
opacity:.45;
filter: alpha(opacity=45);
-moz-opacity: 0.45;
}
div.opaque50 {
width: 100%;
opacity:.50;
filter: alpha(opacity=50);
-moz-opacity: 0.50;
}
div.opaque55 {
width: 100%;
opacity:.55;
filter: alpha(opacity=55);
-moz-opacity: 0.55;
}
div.opaque60 {
width: 100%;
opacity:.60;
filter: alpha(opacity=60);
-moz-opacity: 0.60;
}
div.opaque65 {
width: 100%;
opacity:.65;
filter: alpha(opacity=65);
-moz-opacity: 0.65;
}
div.opaque70 {
width: 100%;
opacity:.70;
filter: alpha(opacity=70);
-moz-opacity: 0.70;
}
div.opaque75 {
width: 100%;
opacity:.75;
filter: alpha(opacity=75);
-moz-opacity: 0.75;
}
div.opaque80 {
width: 100%;
opacity:.80;
filter: alpha(opacity=80);
-moz-opacity: 0.80;
}
div.opaque85 {
width: 100%;
opacity:.85;
filter: alpha(opacity=85);
-moz-opacity: 0.85;
}
div.opaque90 {
width: 100%;
opacity:.90;
filter: alpha(opacity=90);
-moz-opacity: 0.90;
}
div.opaque95 {
width: 100%;
opacity:.95;
filter: alpha(opacity=95);
-moz-opacity: 0.95;
}
div.opaque100 {
width: 100%;
opacity:1.00;
filter: alpha(opacity=100);
-moz-opacity: 1.00;
}
/*]]>*/-->
</style>
</head>

<body>

<div id="fadeMe" onclick="fadeDiv(this.id)" >
Just some random text.
</div>


</body>
</html>

Schitty
12-08-2005, 12:13 PM
thanks dude but i need the text to fade in after clicking a link

TheBearMay
12-08-2005, 02:34 PM
Simple matter of changing the decrement to an increment:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript">
/*<![CDATA [*/
fadeVal=0;
function fadeDiv(divName){
document.getElementById(divName).className="opaque"+fadeVal;
fadeVal+=5;
if(fadeVal < 100) setTimeout("fadeDiv('"+divName+"')",50);
}
/*]]>*/
</script>
<style type="text/css">
<!-- /*[CDATA [*/
div.opaque0 {
width: 100%;
opacity:.00;
filter: alpha(opacity=00);
-moz-opacity: 0.00;
}
div.opaque5 {
width: 100%;
opacity:.05;
filter: alpha(opacity=05);
-moz-opacity: 0.05;
}
div.opaque10 {
width: 100%;
opacity:.10;
filter: alpha(opacity=10);
-moz-opacity: 0.10;
}
div.opaque15 {
width: 100%;
opacity:.15;
filter: alpha(opacity=15);
-moz-opacity: 0.15;
}
div.opaque20 {
width: 100%;
opacity:.20;
filter: alpha(opacity=20);
-moz-opacity: 0.20;
}
div.opaque25 {
width: 100%;
opacity:.25;
filter: alpha(opacity=25);
-moz-opacity: 0.25;
}
div.opaque30 {
width: 100%;
opacity:.30;
filter: alpha(opacity=30);
-moz-opacity: 0.30;
}
div.opaque35 {
width: 100%;
opacity:.35;
filter: alpha(opacity=35);
-moz-opacity: 0.35;
}
div.opaque40 {
width: 100%;
opacity:.40;
filter: alpha(opacity=40);
-moz-opacity: 0.40;
}
div.opaque45 {
width: 100%;
opacity:.45;
filter: alpha(opacity=45);
-moz-opacity: 0.45;
}
div.opaque50 {
width: 100%;
opacity:.50;
filter: alpha(opacity=50);
-moz-opacity: 0.50;
}
div.opaque55 {
width: 100%;
opacity:.55;
filter: alpha(opacity=55);
-moz-opacity: 0.55;
}
div.opaque60 {
width: 100%;
opacity:.60;
filter: alpha(opacity=60);
-moz-opacity: 0.60;
}
div.opaque65 {
width: 100%;
opacity:.65;
filter: alpha(opacity=65);
-moz-opacity: 0.65;
}
div.opaque70 {
width: 100%;
opacity:.70;
filter: alpha(opacity=70);
-moz-opacity: 0.70;
}
div.opaque75 {
width: 100%;
opacity:.75;
filter: alpha(opacity=75);
-moz-opacity: 0.75;
}
div.opaque80 {
width: 100%;
opacity:.80;
filter: alpha(opacity=80);
-moz-opacity: 0.80;
}
div.opaque85 {
width: 100%;
opacity:.85;
filter: alpha(opacity=85);
-moz-opacity: 0.85;
}
div.opaque90 {
width: 100%;
opacity:.90;
filter: alpha(opacity=90);
-moz-opacity: 0.90;
}
div.opaque95 {
width: 100%;
opacity:.95;
filter: alpha(opacity=95);
-moz-opacity: 0.95;
}
div.opaque100 {
width: 100%;
opacity:1.00;
filter: alpha(opacity=100);
-moz-opacity: 1.00;
}
/*]]>*/-->
</style>
</head>

<body>

<div id="fadeMe" >
Just some random text.
</div>
<button onclick="fadeDiv('fadeMe')">Show Text</button>

</body>
</html>