I've created a very simple javascript function where as I hover over certain words, elements with a certain id become transparent. This is working fine with my img tags, but divs with the same id are not changing?
Here is my javascript:
function revealCategory1() { document.getElementById('c2').style.opacity="0.3"; document.getElementById('c3').style.opacity="0.3"; document.getElementById('c4').style.opacity="0.3"; } function revealCategory2() { document.getElementById('c1').style.opacity="0.3"; document.getElementById('c3').style.opacity="0.3"; document.getElementById('c4').style.opacity="0.3"; } function revealCategory3() { document.getElem..............etc function resetReveal() { document.getElementById('c1').style.opacity="1"; document.getElementById('c2').style.opacity="1"; document.getElementById('c3').style.opacity="1"; document.getElementById('c4').style.opacity="1"; } Which is being called by this html:
<div class="bars"> <span class="categories" id="c1" onMouseOver="revealCategory1()" onMouseOut="resetReveal()">VIDEO</span> <span class="categories" id="c2" onMouseOver="revealCategory2()" onMouseOut="resetReveal()">ANIMATION</span> <span class="categories" id="c3" onMouseOver="revealCategory3()" onMouseOut="resetReveal()">DESIGN</span> <span class="categories" id="c4" onMouseOver="revealCategory4()" onMouseOut="resetReveal()">WEB-DESIGN</span> </div> On the page, this is working absolutely fine. The images go transparent.
<div class="logocontainer" > <img class="logo" id="c1" src="images/DOSED-C1.png" /> <img class="logo" id="c2" src="images/DOSED-C2.png" /> <img class="logo" id="c3" src="images/DOSED-C3.png" /> <img class="logo" id="c4" src="images/DOSED-C4.png" /> </div> But this is NOT, the divs don't go transparent.
<div class="maincontent"> <div id="c1" class="content" >VIDEO PIECE 1</div> <div id="c2" class="content" >ANIMATION PIECE 1</div> <div id="c3" class="content" >DESIGN PIECE 1</div> <div id="c4" class="content" >WEB-DESIGN PIECE 1</div> </div>