I need to make the ‘content’ div animate after the inner divs fade out. The fadeOut animation worked before I added the callback though. Can someone tell me what I messed up on the callback function?
<script type = 'text/javascript'>
$(document).ready(function() {
$('#content').click(function() {
$('#topcontent,#bottomcontent').fadeOut(400, function() {
$('#content').css({
position:'relative',
background-color:'black'
}).animate({
height:$(window).height(),
width:$(this).width()
},400);
});
});
});
</script>
</head>
<body>
<div id = 'wrapper'>
<div id = 'content'>
<div id = 'topcontent'>
TOP<br />
</div>
<div id = 'bottomcontent'>
BOTTOM
</div>
</div>
</div>
</body>
Your problem is in the .css() call…
background-color:'black'should bebackground: 'black'or as is pointed out in the comment “background-color”: ‘black’