views:

5733

answers:

1

I have this jQuery:

$(document).ready(function()
{
   $("#panel").hide();

   $('.login').toggle(
   function()
   {
      $('#panel').animate({
      height: "150", 
      padding:"20px 0",
      backgroundColor:'#000000',
      opacity:.8
}, 500);
   },
   function()
   {
      $('#panel').animate({
      height: "0", 
      padding:"0px 0",
      opacity:.2
      }, 500);
   });
});

This is working fine, but I need to extend the functionality a little. I want to also similarly manipulate another div's properties in sync with the #panel div. I tried adding two more functions relating to the secondary div, but I just got a 4-phase toggle...haha! Forgive my ignorance!

Thanks guys!

+2  A: 
$('.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);

});
Vincent Ramdhanie
Ahh...I can't believe I missed that! Thanks a lot!
Kevin Brown