Log In · Register

 
 
Closed TopicStart new topic
Can someone teach me how to do rollovers?
Nikki09815
post May 11 2008, 09:37 AM
Post #1


Member
**

Group: Official Designer
Posts: 11
Joined: Jun 2006
Member No: 425,348



I've looked for some tutorials on them, but I can't seem to find any that I can actually follow.
Can someone, by chance, teach me how?
 
GunsNRachel
post May 11 2008, 11:30 AM
Post #2


Senior Member
****

Group: Member
Posts: 292
Joined: Jul 2007
Member No: 545,047



yes! I'll give you the code I use:

CODE
a.nav{
display:block;
width:165px;
margin:1px;
background-color:white;
font-family:arial!important;
font-size:14px!important;  
font-weight:normal!important;
color:555555!important;
text-decoration:none!important;}

a.nav:hover{
width:165px;
background-color:COLORHERE;
background-image:url(URLHERE);
display:block;
margin:1px;
font-family:arial!important;
font-size:14px!important;  
font-weight:normal!important;
color:9d1829!important;
text-decoration:none!important;
}


This code should go between <style type="text/css"> and </style>. The top code is for the navigation, the bottom is for the rollovers. Where it says "background-color: ;" is where the rollover color goes. If you want it to be an image rollover, you create the image, upload it and put the link where it says "background-image:url(URLHERE);" and that's about it. If you have any questions feel free to ask me and I'll try to help =)

Oh sorry, I forgot something:
When making a link that you want to use the rollover you need to make the link look like this,
CODE
<a class="nav" href="http://home.myspace.com/index.cfm?fuseaction=user">Home</a>
 
Melissa
post May 11 2008, 11:59 AM
Post #3


;)
******

Group: Duplicate
Posts: 2,374
Joined: Feb 2004
Member No: 3,760



There's also this script if you want an image swap rollover:

CODE
<script language="javascript">
<!-- hide script from old browsers

//detect browser:
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
if (browserName == "Netscape" && browserVer >= 3) browserVer = "1";
else if (browserName == "Microsoft Internet Explorer" && browserVer == 4) browserVer = "1";
else browserVer = "2";

//preload images:
if (browserVer == 1) {
a1 = new Image(WIDTH,HEIGHT);
a1.src = "FIRST IMAGE URL";
a2 = new Image(WIDTH,HEIGHT);
a2.src = "ROLLOVER IMAGE URL";

//you can add more as b,c,d,etc.}

//image swapping function:
function hiLite(imgDocID, imgObjName, comment) {
if (browserVer == 1) {
document.images[imgDocID].src = eval(imgObjName + ".src");
window.status = comment; return true;
}}
//end hiding -->
</script>


and then the code:
CODE
<img src="FIRST IMAGE URL" name="a" onMouseOver="hiLite('a','a2','opt title')" onMouseOut="hiLite('a','a1','opt title')">


Try looking on Dynamic Drive: http://www.dynamicdrive.com/dynamicindex15/domroll.htm
 
Nikki09815
post May 12 2008, 08:05 PM
Post #4


Member
**

Group: Official Designer
Posts: 11
Joined: Jun 2006
Member No: 425,348



Thanks so much.

That works even if I use imagemapping right?
 
Melissa
post May 12 2008, 08:08 PM
Post #5


;)
******

Group: Duplicate
Posts: 2,374
Joined: Feb 2004
Member No: 3,760



idk which one you're talking about, but if you're talking about the script I gave you, then yes, it does. You can tweak it a lot to fit your specifications.
 
Insurmountable
post May 12 2008, 08:50 PM
Post #6


Cornflakes :D
*******

Group: Staff Alumni
Posts: 4,541
Joined: Dec 2005
Member No: 322,923



moved to webmasters corner.
 
emmijane
post Jun 5 2008, 12:11 PM
Post #7


the WILD one
***

Group: Official Designer
Posts: 90
Joined: May 2008
Member No: 647,118



LOOKIE PEOPLE!!!

http://www.poqbum.com/roller/index.php
 

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: