Click to See Complete Forum and Search --> : HTML/CSS - Positioning ActiveImage w/hover


mlandrethsf
03-11-2006, 12:36 PM
Hi all-

A little background is necessary before we get to the problem-
1. I am creating this code for a myspace profile, which does not allow the use of javascript.
2. My goal is for an image to appear when a user runs their mouse over a certain part of the page.
3. My logic (feel free to set me straight):
since i cant use the 'onmouseover' 'onclick' commands that i want, i have tried to get in through the back door by creating a background that includes a 'base image' (you'll see what I'm talking about), then add a *transparent* active image with a hover link of the actual image i want to appear. So far, I have gotten everything to work except one little feature: I can not position the activeimage on the page without losing the hover effect. This makes the whole code useless unless i want this effect in the upper left corner, or centered or something. I need the flexibility to choose exactly where everything goes.
I have created a sample code to illustrate the dilemma. I have left the border 'on' for the transparent (active)image so you can see where it is on the page. Obviously i wont be using it on my profile page.

Your goal - get the fried egg to appear when the user mouses over the center of the plate. Have fun.

Here's the code:
<!MAKE HOVER EGG-->
<STYLE type="text/css">
A:hover{background:url(http://img85.imageshack.us/img85/4885/eggs5ll.gif);
}
hr{background-image:url(http://img85.imageshack.us/img85/4885/eggs5ll.gif);
</STYLE>
<br />
<a href="http://www.mypimpspace.com/" target="_blank">
</a>

<style type="text/css">
{ Background Properties }
table, tr, td { background-color:transparent; border:none; border-width:0;}
body {
background-image:url('http://img124.imageshack.us/img124/3986/plate1yw.png');
background-attachment: fixed;
background-position:top left;
background-repeat:no-repeat;
}
</style>

<!TRANSPARENT LINK-->
<a href="http://www.myspace.com/tweetersrevenge"><img src="http://img127.imageshack.us/img127/93/glitterkitty16ru.gif" style=" {"position:absolute; left:1000px; top:1300px; border:0}></a>

ray326
03-11-2006, 07:08 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<meta name="Content-Style-Type" content="text/css">
<title>Breakfast Demo</title>
<style type="text/css">
a:link {
display:block;
width:680px;
height:480px;
background:transparent;
}

a:hover {
background:transparent url(http://img85.imageshack.us/img85/4885/eggs5ll.gif) 200px 200px no-repeat;
}

body {
background:url(http://img124.imageshack.us/img124/3986/plate1yw.png) no-repeat top left;
}
</style>
</head>
<body>
<a href="http://www.myspace.com/tweetersrevenge">&nbsp;</a>
</body>
</html>

mlandrethsf
03-12-2006, 08:51 PM
I tried to open this code from Notepad and nothing happened. Also, i see that there are some references to javascript, which myspace does not support. they will literally filter the word out of my code.
Michelle

ray326
03-12-2006, 10:17 PM
Oh, the empty Javascript script tag is from my template and can be deleted. I see this forum screwed around with the url() parameters. Just delete the [?url] tags it put around them. I'll try to edit it now but if the forum screws it up again you know what to do.

[later]Ok, it's cleaned up now. I had to turn off link parsing in the forum editor.

mlandrethsf
03-13-2006, 12:33 PM
thanks for the help. worked like a charm.
Michelle