I am having trouble with an if / else
statement for fading in and out using a toggle link. I can get the<div>
to fade in, however, I can not seem to get it to fade out. I am somewhat new to if
and else
statements.
Here is the script in question:
<script type="text/javascript">
function toggleFader() {
if ($("#fade_content").is(":hidden")) {
$("#contentThatFades").animate(
{
opacity: "0"
},
600,
function(){
$("#fade_content").fadeOut();
}
);
}
else {
$("#fade_content").fadeIn(600, function(){
$("#contentThatFades").animate(
{
opacity: "1"
},
600
);
});
}
}
</script>