I am using a small piece of javascript to change the visibility of a layer when a link is clicked. At the moment you click the link to turn the layer visible and click to hide again.
I have now been told that once it is visible you should be able to click anywhere on the screen to hide it again. Is that possible?
Obviously the default css for #hiddencontent is display: none
Thanks for any help
I have now been told that once it is visible you should be able to click anywhere on the screen to hide it again. Is that possible?
Code:
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
<a href="#" onclick="toggle_visibility('hiddencontent');return false;">
Obviously the default css for #hiddencontent is display: none
Thanks for any help