Curious about Image Roll Overs

liunx

Guest
Curious,<br />
<br />
I am trying to make a web page that when a user mouses over a line of text, an image pops up somewhere else on the screen. <br />
<br />
Can you only do MouseOvers when using an href ?<br />
<br />
Am i making sence?<br />
<br />
Thanx in advance,<br />
ulysses<!--content-->i have no idea if this would work, but...<br />
<br />
<p onMouseOver="document.all.alayerwithimage.class='cool'"><br />
<br />
and in the CSS<br />
<br />
cool{<br />
position:absolute;<br />
top:whatever;<br />
etc etc etc<br />
}<br />
<br />
or use a .visible="true" in the javascript, i guess<br />
i hope that made sense<!--content-->in modern browsers mouseover will work for most tags. In older browsers the choice is very limited, but fortuantely there are not many old browser left around:<br />
<br />
<html><br />
<head><br />
</head><br />
<body><br />
<div id="lyr" style="visibility:hidden"><br />
<img src=http://www.htmlforums.com/archive/index.php/"yourimage.jpg"><br />
</div><br />
<br />
A whole bunch of other stuff in the page<br />
<br />
<span onMouseover="document.getElementById('lyr).style.visibility='visible'"><br />
show image </span><br />
<br />
</body><br />
</html><!--content-->Hi there COBOLdinosaur,<br />
<br />
You just beat me with your reply..:mad: <br />
But luckily for me your code will not work until...<br />
you pop a single quote here..<br />
getElementById('lyr) :D<br />
<br />
So I will post my effort - fully tested- now :cool:<html><br />
<head><br />
<br />
<style type="text/css"><br />
<!--<br />
div#text<br />
{<br />
font-family:arial;<br />
font-size:16px;<br />
color:#000000;<br />
position:absolute;<br />
top:10%;<br />
left:10%;<br />
}<br />
div#image<br />
{<br />
position:absolute; <br />
top:20%; <br />
left:20%; <br />
visibility: hidden;<br />
}<br />
//--><br />
</style><br />
<br />
<head><br />
<body> <br />
<br />
<div id="image"><img src=http://www.htmlforums.com/archive/index.php/"some.jpg"alt="an image" /></div><br />
<div id="text" onmouseover="getElementById('image').style.visibility='visible'"<br />
onmouseout="getElementById('image').style.visibility='hidden';">A line of text</div><br />
<br />
</body><br />
</html><br />
c:D:Dthead<!--content-->lol fully tested and it works lol i just checked and i had anastacia's picture popping out! thanks a lot thats a cool code !;)<!--content-->That is some very slick stuff for sure.<br />
<br />
I hate to be nieve and ask for more. But i know nothing about CCS and only the very minimul about HTML.<br />
<br />
Where do i put a POSITION IN?<br />
<br />
I need it to appear in a specific spot for the most part every time.<br />
<br />
anythoughts.<br />
<br />
<br />
ulysses freeman<br />
<br />
EDIT:<br />
<br />
When i say location, i would like it to appear in a certain Frame.<!--content-->Hi there ulysses freeman,<br />
<br />
To adjust position in the css is quite easy..:D<br />
<br />
div#text<br />
{<br />
font-family:arial;<br />
font-size:16px;<br />
color:#000000;<br />
position:absolute;<br />
top:10%;<br />
left:10%;<br />
}<br />
<br />
Alter these values to position the text...<br />
you can use either percentage or px(percentages are more flexible)<br />
This will set your text in relation to the top left corner of the page.<br />
<br />
Follow a similar procedure for the image positioning :cool:<br />
<br />
c:cool::cool:thead<!--content-->Originally posted by coothead <br />
Hi there ulysses freeman,<br />
<br />
To adjust position in the css is quite easy..:D<br />
<br />
div#text<br />
{<br />
font-family:arial;<br />
font-size:16px;<br />
color:#000000;<br />
position:absolute;<br />
top:10%;<br />
left:10%;<br />
}<br />
<br />
Alter these values to position the text...<br />
you can use either percentage or px(percentages are more flexible)<br />
This will set your text in relation to the top left corner of the page.<br />
<br />
Follow a similar procedure for the image positioning :cool:<br />
<br />
c:cool::cool:thead <br />
<br />
Thanx.<br />
<br />
What i really need, sorry I realized afterwards, i wasn't making myself clear.<br />
<br />
I need to actualy have the image pop up in the same box at all times.<br />
<br />
And to be honest, it'll move down as the user scrolls down the page.<br />
<br />
So depending on what sentence the user mousing over, will depend on what image box the image shows up in.<br />
<br />
clearer?:confused: <br />
<br />
I hope so<br />
<br />
Ulysses<!--content-->Also, <br />
<br />
can this code be used for MULTIPLE lines?<br />
<br />
What i'm designing is a list of items.<br />
<br />
When the user mouses over an item, the image is suppose to display the image next to it...or in a floating frame.<br />
<br />
So can this code you have shown here, work for mulitple lines?<br />
<br />
ulysses<!--content-->Hi there ulysses,can this code be used for MULTIPLE lines?Yes, this is possible. :D <br />
Of course, as more images are added, the coding <br />
becomes a little more involved :eek:<br />
This is mainly due to the positioning of the image <br />
in line with the mouseover word.<br />
<br />
I have attached an html file so that<br />
you may see how it works in practise :cool: <br />
<br />
c:cool::cool:thead<!--content-->to do it within a iframe you need the name of the frame<br />
<br />
<div id="text" onmouseover="frame_name_here.getElementById('image').style.visibility='visible'"<br />
onmouseout="frame_name_here.getElementById('image').style.visibility='hidden';">A line of text</div><br />
<br />
I beleive that should work, if not you might need something before the frame name.<!--content-->Ok, <br />
<br />
So do I have to do a to do <br />
<br />
#image<br />
{<br />
position:absolute;<br />
etc..etc..<br />
}<br />
<br />
for EVERY picture I decide to do?<br />
<br />
I can't just make one method and then send all pictures there?<br />
<br />
I'm from Java and stuff and I'm of the mind that I should be able to create a single function in order to display the picture all the time, floating at the end of the line.<br />
<br />
Hrmmmmm....I know nothing abuot CCS so i'm trying ot also find information that may helpme.<br />
<br />
Cheers for all the help you have been thus far though.<br />
<br />
ulysses<!--content-->if you want the image to appear in a certain spot but multiple lines then yes you have to tell it where for every picture.<br />
<br />
if the image is in the same spot on every link hovered over than no you do not.<!--content-->Originally posted by scoutt <br />
if you want the image to appear in a certain spot but multiple lines then yes you have to tell it where for every picture.<br />
<br />
if the image is in the same spot on every link hovered over than no you do not. <br />
<br />
Ok, this is the way it works right now<br />
<br />
position:absolute; <br />
top:0%; <br />
left:30%; <br />
visibility:hidden;<br />
<br />
<br />
I want it to be in that possition every time. Even if the user scrolls down. It will be 30% to the left and right at the top of the window.<br />
<br />
I am only going to be scrolling down the screen. BUt either way the picture will always show up. right at the top, 30% to the left.<br />
<br />
<br />
Ulysses<!--content-->will that be for every image? if so then do this<br />
<br />
<br />
<br />
img<br />
{<br />
position:absolute;<br />
etc..etc..<br />
}<br />
<br />
that will make every image be in that spot, but if you don't want every image then you need to keep the #image id there.<br />
<br />
then in your image tags you need to have id="image"<br />
<br />
get it?<!--content-->Originally posted by scoutt <br />
will that be for every image? if so then do this<br />
<br />
<br />
<br />
img<br />
{<br />
position:absolute;<br />
etc..etc..<br />
}<br />
<br />
that will make every image be in that spot, but if you don't want every image then you need to keep the #image id there.<br />
<br />
then in your image tags you need to have id="image"<br />
<br />
get it? <br />
<br />
Ok, i think i understand, and it is NOT what i want..hahah, after all that.<br />
<br />
I realized that if i scroll the page down the bottom, the image still appears on the top of the screen. And in the window.<br />
<br />
I thought that code was based on the window and not on the web page itself. <br />
<br />
Thanx for all the help,<br />
<br />
ulysses<!--content-->
 
Back
Top