View Full Version : Hide/Show behaviours
farmakia
5-30-09, 03:25 AM
After long searching into google about Hide/Show behaviours I didn't seem to find what I was looking for and then I remembered everyone here who has helped me here in the past...
I'm looking for a js code that will allow me unhide a div when a thumbnail is clicked... hope that makes sence. Also if it's not too much an example of how to use the div to prevent confusion...
Thanks for your time and help...
~Farmakis~
Autoload
5-30-09, 10:37 AM
How are you searching? I find hundreds of samples of how to unhide a div layer using java script when I search using Google....
http://www.google.com/search?hl=en&q=show+and+hide+div+layers
Even found some stuff over at DynamicDrive:
http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm
snowmaker
5-30-09, 10:43 AM
Maybe this helps?
Using javascript to show and hide DIV (http://www.webmaster-talk.com/javascript-forum/58119-using-javascript-to-show-hide-div.html)
or this?
show/hide content via <DIV> & Javascript... (http://www.webmasterworld.com/forum91/441.htm)
I'd try to do it with CSS though..
CSS hover technique to display pictures - bytes (http://bytes.com/groups/css/533934-css-hover-technique-display-pictures)
Croc Hunter
5-30-09, 10:49 AM
People are paranoid about running javascript because it can be so powerful.
rainbore
5-30-09, 01:58 PM
Easier to just post some code:
<script type="text/javascript">
function toggleDiv(theDiv) {
(document.getElementById(theDiv).style.visibility == 'visible') ?
document.getElementById(theDiv).style.visibility = 'hidden' : document.getElementById(theDiv).style.visibility = 'visible';
}
</script>
<p><a href="javascript:toggleDiv('showHide');">Click Me!</a><br>
</p>
<br>
<div id="showHide" style="visibility:hidden;">
<p>Now you can see me!<br>
</p>
farmakia
5-31-09, 05:32 AM
Sorry I didn't reply earlier but I figured out how to do it... works like charm...
My code
var ids=new Array('i1','i2','i3');
function switchid(id){
hideallids();
showdiv(id);
}
function hideallids(){
for (var i=0;i<ids.length;i++){
hidediv(ids[i]);
}
}
function hidediv(id) {
if (document.getElementById) {
document.getElementById(id).style.display = 'none';
}
else {
if (document.layers) {
document.id.display = 'none';
}
else {
document.all.id.style.display = 'none';
}
}
}
function showdiv(id) {
if (document.getElementById) {
document.getElementById(id).style.display = 'block';
}
else {
if (document.layers) {
document.id.display = 'block';
}
else {
document.all.id.style.display = 'block';
}
}
}
vBulletin v3.6.0, Copyright ©2000-2010, Jelsoft Enterprises Ltd.