In the style section I can define the position of a specific <li> element (like <li id=”pane0″> ) using
In the <style> section
[code=php]
#pane0 {left: 0px; width: 77px; }
#pane1 {left: 77px; width: 75px; }
#pane2 {left: 152px; width: 70px; }
#pane3 {left: 222px; width: 70px; }
#pane4 {left: 292px; width: 75px; }
And I can define different <style> class names to cause the element to display
a different portion of an image within the element using
[code=php]
.pane00 a:hover { background: transparent url(‘Faces3x10.gif’) 0px -95px no-repeat; }
.pane01 a:hover { background: transparent url(‘Faces3x10.gif’) -77px -95px no-repeat; }
.pane02 a:hover { background: transparent url(‘Faces3x10.gif’) -152px -95px no-repeat; }
.pane03 a:hover { background: transparent url(‘Faces3x10.gif’) -222px -95px no-repeat; }
.pane04 a:hover { background: transparent url(‘Faces3x10.gif’) -292px -95px no-repeat; }
.pane10 a:hover { background: transparent url(‘Faces3x10.gif’) 0px -190px no-repeat; }
.pane11 a:hover { background: transparent url(‘Faces3x10.gif’) -77px -190px no-repeat; }
.pane12 a:hover { background: transparent url(‘Faces3x10.gif’) -152px -190px no-repeat; }
.pane13 a:hover { background: transparent url(‘Faces3x10.gif’) -222px -190px no-repeat; }
.pane14 a:hover { background: transparent url(‘Faces3x10.gif’) -292px -190px no-repeat; }
In the <body> section
[code=php]
<ul id=”skyline”>
<li id=”pane0″ class=”pane00″><a href=”#0″></a></li>
<li id=”pane1″ class=”pane01″><a href=”#1″></a></li>
<li id=”pane2″ class=”pane02″><a href=”#2″></a></li>
<li id=”pane3″ class=”pane03″><a href=”#3″></a></li>
<li id=”pane4″ class=”pane04″><a href=”#4″></a></li>
</li>
Then using javascript I can alter the ‘className’ of the element to show different areas of the main image
when the mouse hovers over the element. ( document.getElementById(‘pane0’).className = ‘pane00’; )
This all works fine.
What I would like to know is:
Is it possible to change the className attribute of the background specifically when the ‘hover’ occurs over the element?
Something like this in JS
[code=php]
document.getElementById(‘pane0’).className[‘pane00’].backgroundTop = ‘-95px’; // this does NOT work
I can’t figure out changing the settings without hard-coding each .pane00 to .pane14 className.
I would like to make the change more dynamic with the use of JS.
?