Wordpress - Javascript Toggle Div elements display styles

pzx5073

New Member
I have a code that I am working on so that it has a heading tag and an arrow floated to the right and when you click on that arrow it shows the contents of the hidden element and changes the down arrow to an up arrow. Everything seems to work fine except the links I have under the image within the toggle do not work. I cannot highlight the text for some reason so I am assuming that there is an overlap somewhere in my coding. The JavaScript\[code\] function toggleDisplayNewark() { document.getElementById("toggleMe").style.display == "none"; if(document.getElementById("toggleMe").style.display == "none" ) { document.getElementById("toggleMe").style.display = "inline"; document.getElementById("toggleMe").style.visibility = "visible"; document.getElementById("arrow").style.background = "url(img/up.png) no-repeat"; } else { document.getElementById("toggleMe").style.display = "none"; document.getElementById("arrow").style.background = "url(img/down.png) no-repeat"; }} \[/code\]The HTML\[code\] <div id='newark'> <div class='text-heading'> <h2>Newark</h2> <a href="http://stackoverflow.com/questions/15574858/#newark" onclick="toggleDisplayNewark();"> <div id='arrow'></div> </a> </div> <div id='toggleMe' style='display: none;'> <div class='alignleft thumb-imgs'> <img src='http://stackoverflow.com/questions/15574858/img/excercise.png' /> <a href='http://exercise.com/' target='_blank'>Exercise Institute</a> </div> <div class='clear'></div> </div> </div>\[/code\]The CSS \[code\]#arrow {background: url(http://emf-websolutions.com/wp-content/uploads/2013/03/down.png) no-repeat; height: 27px; width: 29px; float: right; margin: -30px 10px 0 0;} #toggleMe {display: none;}.text-heading {-webkit-border-radius: 5px; border-radius: 5px; margin: 10px 0; width: 640px; padding: 5px 0px; background: #333; border: 1px solid red;}.clear {clear: both;}.thumb-imgs {width: 204px; height: 210px; padding: 5px 5px 40px 5px;}\[/code\]I built this in a html file before I put it into wordpress so I could make sure that it works properly. I just can't seem to find where the problem lies. I have striped down the coding so that it would not take up so much space. The idea of this is to have a heading with an arrow in the right side to drop down this box with 3 images with a link under each one for each line.Thanks for your help in advance.
 
Back
Top