Link Hover Code (fading links, phpBB mod + code)

Website stuff

Moderators: Big-O Ryan, Big-O Mark

Post Reply
stpmatts
Just Registered
Just Registered
Posts: 2
Joined: Sat Oct 12, 2002 1:06 am
Contact:

Link Hover Code (fading links, phpBB mod + code)

Post by stpmatts »

On the default forum skin, what is the code to make the links fade to orange? I've looked for this but couldn't find it. And if it is possible to do this through Dreamweaver, that would help out even more.

Thanks.
User avatar
Plasma2002b
Extreme Groupie
Extreme Groupie
Posts: 976
Joined: Thu Jul 18, 2002 11:36 pm
Location: Riverside, Ca
Contact:

Re: Link Hover Code

Post by Plasma2002b »

stpmatts wrote:On the default forum skin, what is the code to make the links fade to orange? I've looked for this but couldn't find it. And if it is possible to do this through Dreamweaver, that would help out even more.

Thanks.


STP.... you can do this in javascript..... just put this in a js file or in the head to your file.....


also, make your links to have no underline (just looks better... you can mess around with the settings)




startColor = "#000000";
endColor = "#ffffff";
stepIn = 20;
stepOut = 20;
autoFade = true;
sloppyClass = false;


hexa = new makearray(16);
for(var i = 0; i < 10; i++)
hexa = i;
hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
hexa[13]="d"; hexa[14]="e"; hexa[15]="f";

document.onmouseover = domouseover;
document.onmouseout = domouseout;

startColor = dehexize(startColor.toLowerCase());
endColor = dehexize(endColor.toLowerCase());

var fadeId = new Array();

function dehexize(Color){
var colorArr = new makearray(3);
for (i=1; i<7; i++){
for (j=0; j<16; j++){
if (Color.charAt(i) == hexa[j]){
if (i%2 !=0)
colorArr[Math.floor((i-1)/2)]=eval(j)*16;
else
colorArr[Math.floor((i-1)/2)]+=eval(j);
}
}
}
return colorArr;
}

function domouseover() {
if(document.all){
var srcElement = event.srcElement;
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
fade(startColor,endColor,srcElement.uniqueID,stepIn);
}
}

function domouseout() {
if (document.all){
var srcElement = event.srcElement;
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
fade(endColor,startColor,srcElement.uniqueID,stepOut);
}
}

function makearray(n) {
this.length = n;
for(var i = 1; i <= n; i++)
this = 0;
return this;
}

function hex(i) {
if (i < 0)
return "00";
else if (i > 255)
return "ff";
else
return "" + hexa[Math.floor(i/16)] + hexa[i%16];}

function setColor(r, g, b, element) {
var hr = hex(r); var hg = hex(g); var hb = hex(b);
element.style.color = "#"+hr+hg+hb;
}

function fade(s,e, element,step){
var sr = s[0]; var sg = s[1]; var sb = s[2];
var er = e[0]; var eg = e[1]; var eb = e[2];

if (fadeId[0] != null && fade[0] != element){
setColor(sr,sg,sb,eval(fadeId[0]));
var i = 1;
while(i < fadeId.length){
clearTimeout(fadeId);
i++;
}
}

for(var i = 0; i <= step; i++) {
fadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" +
step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+
")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step);
}
fadeId[0] = element;
}
Image

its teh infamous life of brian gaut to teh max0r!
stpmatts
Just Registered
Just Registered
Posts: 2
Joined: Sat Oct 12, 2002 1:06 am
Contact:

Post by stpmatts »

Thanks a lot. :)
User avatar
Big-O Ryan
Developer
Developer
Posts: 612
Joined: Fri Oct 19, 2001 11:00 pm
Location: Big-O Software
Contact:

Post by Big-O Ryan »

There's a phpBB mod for this (fading links) at phpbb.com's mod section.
-Ryan
Big-O Software
User avatar
lunatic
Addict
Addict
Posts: 29
Joined: Mon Oct 14, 2002 3:31 pm
Location: None O Yo' Beeznazz
Contact:

Post by lunatic »

heh i like dat idea... i make web pages, this is the first time i really noticed that... well i use flash almost all the time for my links and stuff so... well thanks for the code plasma... and ryan for the mod info. 8)
~LuNaTiC~
User avatar
Michael
Fanatic
Fanatic
Posts: 161
Joined: Sun Sep 29, 2002 8:20 am
Location: New York, USA
Contact:

Post by Michael »

It's not JS, you can do it through style sheets too. Set up a style sheet in the header of your HTML document, then use this code:

Code: Select all

A:hover {text-decoration:none; color:color}
(For color, you can use a word such as red, green, etc., or a 6-digit hexadecimal code.
User avatar
lunatic
Addict
Addict
Posts: 29
Joined: Mon Oct 14, 2002 3:31 pm
Location: None O Yo' Beeznazz
Contact:

Post by lunatic »

Michael wrote:It's not JS, you can do it through style sheets too. Set up a style sheet in the header of your HTML document, then use this code:

Code: Select all

A:hover {text-decoration:none; color:color}
(For color, you can use a word such as red, green, etc., or a 6-digit hexadecimal code.
dat works too... may b i'll use dat sometime... well thx michael... 8)


~1~
~LuNaTiC~
User avatar
Master Jedi
Guru
Guru
Posts: 1161
Joined: Sat Jun 15, 2002 10:34 pm
Contact:

Post by Master Jedi »

Michael wrote:It's not JS, you can do it through style sheets too. Set up a style sheet in the header of your HTML document, then use this code:

Code: Select all

A:hover {text-decoration:none; color:color}
(For color, you can use a word such as red, green, etc., or a 6-digit hexadecimal code.
Why stop there? You can put any style in there that links support:

A:hover {text-decoration:none; color:white;background-color:black;font-family:arial;font-weight:bold;text-indent:200px}
User avatar
lunatic
Addict
Addict
Posts: 29
Joined: Mon Oct 14, 2002 3:31 pm
Location: None O Yo' Beeznazz
Contact:

Post by lunatic »

idejsecrofkrad wrote:
Michael wrote:It's not JS, you can do it through style sheets too. Set up a style sheet in the header of your HTML document, then use this code:

Code: Select all

A:hover {text-decoration:none; color:color}
(For color, you can use a word such as red, green, etc., or a 6-digit hexadecimal code.
Why stop there? You can put any style in there that links support:

A:hover {text-decoration:none; color:white;background-color:black;font-family:arial;font-weight:bold;text-indent:200px}
now dat helps out a whole lot more... thx everyone... 8)


~1~
~LuNaTiC~
User avatar
Michael
Fanatic
Fanatic
Posts: 161
Joined: Sun Sep 29, 2002 8:20 am
Location: New York, USA
Contact:

Post by Michael »

idejsecrofkrad wrote:Why stop there? You can put any style in there that links support:

A:hover {text-decoration:none; color:white;background-color:black;font-family:arial;font-weight:bold;text-indent:200px}
True, you can put any text formatting in the tag, but it is a bad idea to make links change to bold or alter the indent on a hover.
User avatar
Master Jedi
Guru
Guru
Posts: 1161
Joined: Sat Jun 15, 2002 10:34 pm
Contact:

Post by Master Jedi »

Michael wrote:
idejsecrofkrad wrote:Why stop there? You can put any style in there that links support:

A:hover {text-decoration:none; color:white;background-color:black;font-family:arial;font-weight:bold;text-indent:200px}
True, you can put any text formatting in the tag, but it is a bad idea to make links change to bold or alter the indent on a hover.
I know, it was just an example.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest