jQuery toggle animation
$('.login').toggle( function(){ $('#panel').animate({ height: "150", padding:"20px 0", backgroundColor:'#000000', opacity:.8 }, 500); $('#otherdiv').animate({ //otherdiv properties here }, 500); }, function(){ $('#panel').animate({ height: "0", padding:"0px 0", opacity:.2 }, 500); $('#otherdiv').animate({ //otherdiv properties here }, 500);});
I dont think adding dual functions inside the toggle function works for a registered click event (Unless I'm missing something)
For example:
$('.btnName').click(function() { top.$('#panel').toggle(function() { $(this).animate({ // style change }, 500); }, function() { $(this).animate({ // style change back }, 500); });