View Full Version : Hide an Image or element

06-23-2011, 03:11 AM
Ok... i have some images in my site, but i want them to be invisible until the behavior of "show/hide elements" is triggered and then they will appear. How can i make those images invisible ?

06-23-2011, 03:35 AM
CSS visibility: hidden;

Hidden items still take up space, they just aren't visible.

Use display: none; if you don't want the object to take up space initially. But that won't work with the show/hide behavior.

06-23-2011, 03:47 AM
this javascript should do it<script type="text/javascript">
function toggle(element) {
if (document.getElementById(element).style.display == "none") {
document.getElementById(element).style.display = "";
} else {
document.getElementById(element).style.display = "none";

and html
<a href="javascript:toggle('hidden')"><span class="style1"><strong>CLICK HERE</strong></span></a>
<div id="hidden" style="display:none;">-->

your content


06-23-2011, 04:37 AM
Thanx.... that really worked out great