I have a hidden div #about. By clicking the link #clickme the div gets unhidden by a function. Unfortunately the CSS transition (opacity) is not working though it should keep both classes .hide and .unhide including the transitions. Any ideas?
HTML
<li><a id="clickme" href="javascript:unhide('about');">click me</a></li>
<div id="about" class="hide">
<p>lorem ipsum …</p>
</div>
CSS
.hide {
display: none;
-webkit-transition: opacity 3s;
-moz-transition: opacity 3s;
-o-transition: opacity 3s;
transition: opacity 3s;
opacity:0;
}
.unhide {
display: inline;
opacity:1;
}
SCRIPT
<script>
function unhide(divID) {
var element = document.getElementById(divID);
if (element) {
element.className=(element.className=='hide')?'hide unhide':'hide';
}
}
</script>