Problem with animation effect

Problem with animation effect

Hello beautiful people. I have problem with animation effect.


objective:

When the mouse cursor over the button opens the div and occur 2 options:
1 - If I'm inside the div and then the mouse leaves the div closes
2 - If I'm not inside the div and the mouse leaves the div closes

Code:

  1.  $("#button").hover(function(){
  2. $(this).addClass("active");  
  3. $('#content').slideDown();}
  4. ,function(event){
  5.  if($('#content').is(":hover"))
  6.     {
  7. $('#content').slideDown();
  8. event.stopPropagation();
  9.         return true;
  10.     }
  11. else {
  12. $('#content').slideUp();
  13.         $("#button").removeClass("active");
  14. return false;
  15. }   
  16.  });


  17. $('#content').mouseleave(function () {
  18. $(this).slideUp();
  19. $("#button").removeClass("active");
  20. });
  21. $('#content').hover(function(event) {    
  22.     event.stopPropagation();
  23. });

mikepianist.-