Log In · Register

 
link hover
rayyyy
post Jun 28 2008, 06:19 PM
Post #1


Senior Member
***

Group: Member
Posts: 79
Joined: Oct 2007
Member No: 583,422



My links for my site are in my header banner. How would I make it so when I hover over those links something shows up.

thanks.
 
 
Start new topic
Replies
Melissa
post Jun 29 2008, 12:23 AM
Post #2


;)
******

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



^ yeah, it is possible for image maps. The only problem you'll have is that your rollover won't work for Opera (as I've come to find out)

Here's a script if you're planning to use image maps. This also works if you splice your image:

What you'll need is your original picture; copy that as many times as you have links. For each new copy, you'll want to edit out the part that's going to change, then load the original and copies in this script.

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 = "ORIGINAL/BASE IMAGE SRC URL";
a2 = new Image(WIDTH,HEIGHT);
a2.src = "IMAGE 2 SRC URL";
a3 = new Image(WIDTH,HEIGHT);
a3.src = "IMAGE 3 SRC URL";
}

//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>


Change the "IMG SRC URL" and the "WIDTH, HEIGHT" to your own categories and add as many as you need past "a3"

Now, take your original/base image and put in your image map like this:

CODE
<img src="ORIGINAL IMAGE SRC NAME" name="a" usemap="#NAME">
<map name="NAME">
<area shape="poly" coords="[enter coords]" href="URL" onMouseOver="hiLite('a','a2','')" onMouseOut="hiLite('a','a1',''>
<area shape="poly" coords="[enter coords]" href="URL" onMouseOver="hiLite('a','a3','')" onMouseOut="hiLite('a','a1',''>
</map>


What it does is take your image, then swap it for your alternative image on the "mouseover" for the image map, then swap it back to the original on the "mouseout"

This code works for Firefox and IE and Safari (I'm pretty sure). Thomas couldn't see my rollovers, so I guess it doesn't work for Opera.
 

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: