views:

202

answers:

2

I'm using hover() as suggested in the documentation:

 $("#div").hover(
     function(){$(this).addClass('cie_hover');},          
     function(){$(this).removeClass('cie_hover') ;}      
 );

Is there a way I can use more functions on other objects? And if so what would be the syntax to introduce functions in array?

What I would like to do with that is change the class of the div I'm hovering and sildeDown() another one elsewhere with that same hover() action.

+3  A: 

Those are just function call backs. The body of the function can be anything you want:

 $('#div').hover(
      function(){
           $(this).addClass('cie_hover');
           $('#otherdiv').slideDown();
      }, function(){
           $(this).removeClass('cie_hover');
           $('#otherdiv').slideUp();
      }
 );
thedz
Good catch -- thanks!
thedz
Awesome Thanks!
Zero G
A: 

Simply add it into the anonymous function executed on hover over

 $("#div").hover(
 function(){
     $(this).addClass('cie_hover');
     $('selector for thing you want to slide down').slideDown();
 },          
 function(){
     $(this).removeClass('cie_hover');
 });
Russ Cam