TheLinkerG
asked on
Rollover Gallery WITHOUT absolute positioning
I really like the idea of the answer provided to this question:
https://www.experts-exchange.com/questions/20444309/Trying-to-create-a-gallery-page-with-disjointed-rollovers.html
It's your basic rollover script, with pictures listed around a central display area. However, it relies on absolute positioning. I'm designing a website which has a set template, and this needs to be just another page with the same template, except it happens to have an image gallery in it. Does that make sense?
So, how can I modify this code so that I can drop it into my existing template and it will show up correctly?
https://www.experts-exchange.com/questions/20444309/Trying-to-create-a-gallery-page-with-disjointed-rollovers.html
It's your basic rollover script, with pictures listed around a central display area. However, it relies on absolute positioning. I'm designing a website which has a set template, and this needs to be just another page with the same template, except it happens to have an image gallery in it. Does that make sense?
So, how can I modify this code so that I can drop it into my existing template and it will show up correctly?
have you tried changing all the absolute references to relative?
ASKER
I understand the idea, but I don't have the precise knowledge of what to change. I'm pretty sure the word "absolute" has to go, but beyond that I'd be casting about blindly. Here's the pertinent code. Could you be a little more specific in your response?
<a href="" style="position:absolute;v isibility: visible;to p:0;left:0 ;z-index:1 " onMouseOver="document.all. image.src = 'image1.gif'; document.all.image.style.v isibility = 'visible'" onMouseOut="document.all.i mage.style .visibilit y = 'hidden'; document.all.image.src = 'none'">One</a>
<a href="" style="position:absolute;v isibility: visible;to p:0;left:1 00;z-index :1" onMouseOver="document.all. image.src = 'image2.gif'; document.all.image.style.v isibility = 'visible'" onMouseOut="document.all.i mage.style .visibilit y = 'hidden'; document.all.image.src = 'none'">Two</a>
<a href="" style="position:absolute;v isibility: visible;to p:0;left:2 00;z-index :1" onMouseOver="document.all. image.src = 'image3.gif'; document.all.image.style.v isibility = 'visible'" onMouseOut="document.all.i mage.style .visibilit y = 'hidden'; document.all.image.src = 'none'">Three</a>
<a href="" style="position:absolute;v isibility: visible;to p:100;left :0;z-index :1" onMouseOver="document.all. image.src = 'image4.gif'; document.all.image.style.v isibility = 'visible'" onMouseOut="document.all.i mage.style .visibilit y = 'hidden'; document.all.image.src = 'none'">Four</a>
<a href="" style="position:absolute;v isibility: visible;to p:100;left :200;z-ind ex:1" onMouseOver="document.all. image.src = 'image5.gif'; document.all.image.style.v isibility = 'visible'" onMouseOut="document.all.i mage.style .visibilit y = 'hidden'; document.all.image.src = 'none'">Six</a>
<a href="" style="position:absolute;v isibility: visible;to p:200;left :0;z-index :1" onMouseOver="document.all. image.src = 'image6.gif'; document.all.image.style.v isibility = 'visible'" onMouseOut="document.all.i mage.style .visibilit y = 'hidden'; document.all.image.src = 'none'">Seven</a>
<a href="" style="position:absolute;v isibility: visible;to p:200;left :100;z-ind ex:1" onMouseOver="document.all. image.src = 'image7.gif'; document.all.image.style.v isibility = 'visible'" onMouseOut="document.all.i mage.style .visibilit y = 'hidden'; document.all.image.src = 'none'">Eight</a>
<a href="" style="position:absolute;v isibility: visible;to p:200;left :200;z-ind ex:1" onMouseOver="document.all. image.src = 'image8.gif'; document.all.image.style.v isibility = 'visible'" onMouseOut="document.all.i mage.style .visibilit y = 'hidden'; document.all.image.src = 'none'">Nine</a>
<img id="image" src="none" style="position:absolute;v isibility: hidden;top :100;left: 100;z-inde x:1">
<a href="" style="position:absolute;v
<a href="" style="position:absolute;v
<a href="" style="position:absolute;v
<a href="" style="position:absolute;v
<a href="" style="position:absolute;v
<a href="" style="position:absolute;v
<a href="" style="position:absolute;v
<a href="" style="position:absolute;v
<img id="image" src="none" style="position:absolute;v
find all of the absolute's and replace with: relative.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In my example, at the third link (image3.gif), replace
document.getElementById('i mage').vis ibility = 'visible'"
with
document.getElementById('i mage').sty le.visibil ity = 'visible'" (forgot ".style" there)
Just a reminder:
When an element is positioned absolutely, it will position itself relative to it's parent element as long as the parent element is itself positioned other than "static" (the default value), position:relative will do. Otherwise (if the parent element doesn't have a position specified or if the position is "static"), the absolutely positioned child will position itself relatively to the next non-statically positioned ancestor on the page, and, if none available, relatively to the body of the document.
document.getElementById('i
with
document.getElementById('i
Just a reminder:
When an element is positioned absolutely, it will position itself relative to it's parent element as long as the parent element is itself positioned other than "static" (the default value), position:relative will do. Otherwise (if the parent element doesn't have a position specified or if the position is "static"), the absolutely positioned child will position itself relatively to the next non-statically positioned ancestor on the page, and, if none available, relatively to the body of the document.