Looking to add some smooth sliding animation to this basic JS code instead of the glitchy appearance it currently has.
I've experimented with different options but haven't had any success, any suggestions? Here's the code snippet along with the Jsfiddle link:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<style>
body{margin:0;}
#foo{min-width:400px; height:100%; background-color:#9C0; display:none; position:absolute; right:0px; top:0px;}
</style>
<body>
<a href="#" onclick="toggle_visibility('foo');">Click here to toggle visibility of element #foo</a>
<div id="foo" >
</div>
<script type="text/javascript">
<!--
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
//-->
</script>
</body>
</html>