Link to home
Start Free TrialLog in
Avatar of Quarfelburg
Quarfelburg

asked on

Simple question - onmouseover affecting other elements

Hi this is a simple question I just do not know the JS syntax.  I want a mouseover image to activate a mouseover on another element.

As an example visit http://www.greenteadesign.com/test.html

Now look at the mouseover on the thumbnail in the left panel.  It currently borders the thumb in green as well as showing a transparent gif on the main image (right panel).

What I want to do is have the mouseover on the transparent gif (right panel), border the corresponding thumbnail (left panel)

Here is the JS for the thumbnails:

<script language="JavaScript1.2">
/*
Highlight Image Script II-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
      
function borderit(which,color){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
which.style.borderColor=color
}
}
</script>

And here is the code on the thumb referencing the JS for the thumbnail:

<a href="stereostep.html" class="small" onMouseOut="toggle('item1')" onmouseover="toggle('item1')"><img src="images/steptansu/stereostep-2tone-thumb.jpg" width=65 height=55 alt="" border=0 class="borderimage" onMouseover="borderit(this,'#647F5B')" onMouseout="borderit(this,'white')"><br></a>

Finally here is the code for one of the transparent gifs:

<div id="Stepper" style="position:absolute; width:165px; height:167px; z-index:9; left: 524px; top: 296px" onMouseOver="toggle('item1')" onMouseOut="toggle('item1')"><a href="#"><img src="spacer.gif" width="165" height="167" border="0"></a></div>

Thanks in advance,
Hayden

(P.S. Additionally I would like the red text links to the right of the thumbnails to hover when the thumb is onmouseover, I'm not sure if that deserves another thread)


                                                 
Avatar of VincentPuglia
VincentPuglia

Hi,

  I'm somewhat confused by the terminology 'bordering' ...
do you want the transparent image when hovered over some object in the center image to be reflected in the thumbnails?  that is, if I move my mouse over the table in the large foto, the green borders should appear around the thumbnail table

Vinny
Avatar of Quarfelburg

ASKER

Right so if you move your mouse over the steochest on the main photo, the stepchest thumbnail to the left will be bordered (js supplied above)
doing this is not a problem.

first we need to look at the layout.

right now when you mouse over them they are NOT positioned correctly.

You need to move you div style left and top over so that each bracket actually placed where it should be.

Making a element border is not the problem. I think you should get your position fixed first.
BTW

you can slice the image up in an editor, but it may or may not be trouble
Hi hayden,

  Actually, if you wish to do what I think you want to do, you need to make the center image an imagemap  So that you can reference portions of it when moused over and send info to the bracket divs when hovering over the thumbnails.

Vinny
Jay I'm a bit confused.  What is not positioned correctly?  

"Right so if you move your mouse over the stepchest on the main photo, the stepchest thumbnail to the left will be bordered (js supplied above)"

If you mean the borders are not positioned correctly that relates to my other question about resolution changes.  On 1280x968 they are correct.  Any other resolution and they are all over the place.   When we first made the test page in one table a switch in resolution made no difference.

>>... the borders are not positioned correctly...
If they are invisible, there is no need for initial posiitoning (which means you don't care what the resolution is).
You only need to be concerned about positioning when they are visible -- that is, when you mouse over the 'big' picture.  You can track the document's cursor movements easily, but you do not know which 'item' the mouse is over -- unless the image is a map (sliced in jay's post)

Vinny
I tried image mapping but it flickers and is not the solution I would like to use.  In one of the test pages Jay made (http://www.greenteadesign.com/jay.html) the resolution did not matter.  I am wondering why that is, and how I can fashion my current layout (test.html) in the same way.

I only checked it out in 8x6.
because he absolutely positioned everything to fit that page.  If you move the 'items' tds to the top of the page (so they appear on the left like yours), you will see that it falls apart.

I'm sure he'll come by and tell you how he determined where the positioning was.

Vinny
i am working on a new layout.

Using only div and spans.

I will post when i am done
Hi Jay, any update?

I'm curious, why does a non table layout fix the resolution problem?
Q

try this link tell me what you think.

I am on a t1 connection so it loads almost instantly, but it may take little bit longer for dial up

I preload the images with javascript, but i also put them in a hidden DIV. that away they are already loaded.

Also it may be slower on the test server i use.

It will probaly be faster on your on server.

View the source and you can copy all the images
sorry it took me so long. I have been busy today
Jay, so sorry, what link?
I see so you've made mouseovers of the entire image.  Though that means the page will take 56kers a while to load.

Why divs and spans?  Can this be done with mouseovers of the border?  How does potterybarn do it?

So many questions... =)

In an unrelated questions do you suggest coding in divs instead of tables?  I feel I may still be stuck in the past.
Yes tables are for Tabular Data.


Give me a minute or two.

What i am fixiing to do is make a zoom

Mouseover the pic and then it will show it off to the side
hate to say it jay, but at 28,800 bps it is ssssssssllllllooow -- so I killed it.

quarfelburg:
where is the potterybarn url?

divs/spans are the 'in' thing for web design; tables are passe -- like me :)  I still try to use the most expedient, crossBrowser friendly code whenever possible.  A lot of the new design techniques throw the old browsers to the dogs; some even ignore IE because it isn't 'standards compliant'  -- while the 'standards compliant browsers' getting the most attention are only in their -2 versions and being used perhaps by as many people as use NN4.  But they are a vocal group.

Vinny
Vinny,

Ah well I have pretty much given up on ns4.  So div layouts only work on stardards compliant browsers such as Opera?  Are any versions of IE standard compliant?

Potterybarn bordering example:

http://ww2.potterybarn.com//cat/roomindex.cfm?cid=romlivcab&cmsrc=&src=rmscromliv%7Crrooms%2Frmscrom%7Crrooms%2Fhme

I just don't get why it works in all resolutions, as it uses absolute positioning.

Jay,

Cheers.
try the link now.

I have to go for now but will check back tonight
Compliance is still a very 'touchie' subject, especially among some of the 'experts' here (as I'm finding out in another thread'.
Dependent upon whom you speak to IE5+ is compliant, and then again  it isn't.  Mozilla Firebird ver .6 is compliant, except for those things it hasn't implemented yet.  The same is probably true for Safari.  Of them all, Opera probably is the most compliant.  The funniest thing about compliance is that it is a moving target -- by the time the browsers become compliant, the standards will have changed and everything begins anew -- same ole, same hole.

re divs & standards: the newer browsers (even non-standard) allow a lot more flexibility in manipulating the page's layout with a minimal of effort (sort of like giving a grade school kid a calculator for addition/subtraction problems).  So yes, if you can, design around divs/spans -- they will be here for a while.  If you have problems, fall back on what you know.  Each step and fall will be a gain.

I'll take a look at pottery barn and let you know.

Vinny
Nice artical Vinny

Vinny coding with spans and div are really easy once u get the hang of it. Also when you do you will see that maintanec is easier. and load times are faster. (Not in this case since i have 40 11 thousand images) ;)

Take care of him vinny while im gone ;)

You never know i may have a bonus for you in another thread

lol
Jay:
The zoom rollover and thumb images work but the main pic doesnt load.  I understand the idea but cannot see the images =(

Vincent:
I'll try recoding in div/spans - it has a potential SEO advantage as file sizes are lower, and content can be at the top of the page.  Worth a try at least.

I'll be gone for the weekend (Happy Hallowe'en EE) but I'll be back to check on this never-ending post on Monday!

Thanks so much both of you for your help thus far.  I've increased the points to 750 as this thread has gone on a bit of a tangent.  



it loaded 4 me on AOL at my house (Dial Up)

Did not take to long either
I'm back.  Jay I had a look at test2.html and must say that I prefer the bordering instead of the image popping up to the left.  

Is it the JS in Potterybarn that lets them do this in any resolution?  They are coding in tables as well, with no image maps, and using only the border mouseovers.

And as per the original question *read original question*...

Thanks, I will post extra points to both of you guys no matter what - you've been an invaluable aid.
Qu..

Let me go back and reread the source at potterybarn
I am going to go back and tack the code that i initially submitted and just use transparent image and hidden div.

I think that is what they are doing.

What makes this kinda difficult with your image is the stepper, part of it is behind the table so therefore we have to get it where the div is not overlapping others. If that makes since

Be back with results Hopefully
I see - yes it makes sense.

Will be waiting patiently =)
Any update?  
ASKER CERTIFIED SOLUTION
Avatar of jaysolomon
jaysolomon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial